Discussion:
Bug#906256: Bug#905379: anki: hangs after "'NoneType' object has no attribute 'installEventFilter'"
(too old to reply)
Julian Gilbey
2018-08-16 10:00:02 UTC
Permalink
Dear Qt maintainers,

I've cloned this bug reported against anki to libqt5webengine5, as it
seems that this is the source of the bug. I don't know enough about
Qt's internals to be able to track it down. It seems as though this
is a known problem: https://bugreports.qt.io/browse/QTBUG-68547
It's possible that the bug is in PyQt5, but that would seem unlikely.
But either way, something somewhere is very broken, and I don't know
exactly where.

The original report for your ease of reference, followed by a more
detailed explanation:

-----

Package: anki
Version: 2.1.0+dfsg~rc2-2
Severity: grave
Justification: renders package unusable

Anki presents a dialog with the following error message at startup and
then hangs after the dialog is dismissed:

Error during startup:
Traceback (most recent call last):
File "/usr/share/anki/aqt/main.py", line 50, in __init__
self.setupUI()
File "/usr/share/anki/aqt/main.py", line 75, in setupUI
self.setupMainWindow()
File "/usr/share/anki/aqt/main.py", line 585, in setupMainWindow
tweb =3D self.toolbarWeb =3D aqt.webview.AnkiWebView()
File "/usr/share/anki/aqt/webview.py", line 114, in __init__
self.focusProxy().installEventFilter(self)
AttributeError: 'NoneType' object has no attribute 'installEventFilter'

Sending ^c after waiting for a minute or so of waiting produces the
error:

Exception ignored in: <module 'threading' from '/usr/lib/python3.6/threading.py'>
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 1294, in _shutdown
t.join()
File "/usr/lib/python3.6/threading.py", line 1056, in join
self._wait_for_tstate_lock()
File "/usr/lib/python3.6/threading.py", line 1072, in _wait_for_tstate_lock
elif lock.acquire(block, timeout):
KeyboardInterrupt

-----

My analysis:

Anki runs (/usr/share/anki/aqt/webview.py, line 18):

QWebEngineView.__init__(self, parent=parent)

which seems to run fine, but something seems wrong, as
self.focusProxy() is Null after this. A few lines later, it runs
(line 18):

QWebEnginePage.__init__(self)

which gives the error:

[0816/101823.790400:WARNING:stack_trace_posix.cc(699)] Failed to open file: /tmp/.gloFZVqc (deleted)
Error: No such file or directory

And it's all downhill from there: a few lines later, it tries to call
self.focusProxy().installEventFilter(self), but as self.focusProxy()
is Null, it bombs out.

Julian
Julien Puydt
2018-09-20 06:50:01 UTC
Permalink
Hi,

I hadn't launched anki since long and hence got stuck.

Looking at the trace I see:
self.focusProxy().installEventFilter(self)
and an attribute error that NoneType has no installEventFilter, so it's
quite clear what the problem is:

self.focusProxy() returns None!

That might mean that some versions of PyQT were having a default focus
proxy and that line worked, but newer versions need an explicit setup.

Commenting the line makes it possible to go further, with a few error
windows showing up.

I would suggest asking around.

jpuydt on irc.debian.org
Roland Hieber
2018-10-25 22:40:01 UTC
Permalink
Post by Julien Puydt
Hi,
I hadn't launched anki since long and hence got stuck.
self.focusProxy().installEventFilter(self)
and an attribute error that NoneType has no installEventFilter, so it's
self.focusProxy() returns None!
That might mean that some versions of PyQT were having a default focus
proxy and that line worked, but newer versions need an explicit setup.
Commenting the line makes it possible to go further, with a few error
windows showing up.
I would suggest asking around.
That particular part of the code was refactored in upstream commit
https://github.com/dae/anki/commit/1af556cb8d62a638f7fa0bcb6289bf932d338691
and although I was able to backport that single commit onto 2.1.5+dfsg-1
and that particular error went away, I still didn't get a very
functional Anki window afterwards (only a menu bar with a grey window,
but also three new tabs with data:text/html URLs in my Firefox o_O). So
I guess there is still more to it than meets the eye for full pyqt 5.11
support.

- Roland
Julian Gilbey
2018-10-26 15:40:01 UTC
Permalink
Post by Roland Hieber
That particular part of the code was refactored in upstream commit
https://github.com/dae/anki/commit/1af556cb8d62a638f7fa0bcb6289bf932d338691
and although I was able to backport that single commit onto 2.1.5+dfsg-1
and that particular error went away, I still didn't get a very
functional Anki window afterwards (only a menu bar with a grey window,
but also three new tabs with data:text/html URLs in my Firefox o_O). So
I guess there is still more to it than meets the eye for full pyqt 5.11
support.
Dear Roland,

Thanks so much for letting me know this - I hadn't spotted it.

Woo-hoo, it works for me! I wonder whether you needed to rebuild the
UI?

I've just uploaded a version based on git to unstable
(2.1.5+dfsg+2.1.6-test.20181026.b4f4e65c-1) so you can test it. Does
this version work for you? I won't close this bug report until the
next official release (2.1.6) (assuming that it works for you, of
course), as I don't want the package to migrate to testing until then;
it may not fully match the packaged upstream version (translations
etc.).

Best wishes,

Julian
Debian Bug Tracking System
2018-12-09 08:00:01 UTC
Permalink
Your message dated Sun, 09 Dec 2018 07:49:10 +0000
with message-id <E1gVtpu-000HiF-***@fasolo.debian.org>
and subject line Bug#905379: fixed in anki 2.1.6+dfsg~beta2-1
has caused the Debian Bug report #905379,
regarding hangs after "'NoneType' object has no attribute 'installEventFilter'"
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ***@bugs.debian.org
immediately.)
--
905379: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=905379
Debian Bug Tracking System
Contact ***@bugs.debian.org with problems
Loading...