[PyQt] Occasionally getting QBuffer in QApplication.focusChanged slot

Florian Bruhin me at the-compiler.org
Wed May 11 07:47:15 BST 2016


I have a slot (decorated with @pyqtSlot('QWidget*', 'QWidget*')) which
is connected to QApplication::focusChanged:

https://github.com/The-Compiler/qutebrowser/blob/v0.6.2/qutebrowser/app.py#L154
https://github.com/The-Compiler/qutebrowser/blob/v0.6.2/qutebrowser/app.py#L342-L357

Now it seems sometimes that slot gets called with a QBuffer as
argument:

	Traceback (most recent call last):
	  File ".../qutebrowser/app.py", line 348, in on_focus_changed
		window = new.window()
	AttributeError: 'QBuffer' object has no attribute 'window'

I couldn't reproduce it myself so far, but I've seen this reported by
three people (with PyQt 5.5.1 / Qt 5.6).

I'll just add a type check which ignores this scenario, but I'm kind
of curious how this happens, so if anyone has an idea what's going on,
let me know!

Florian

-- 
http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc
         I love long mails! | http://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160511/45919d63/attachment.sig>


More information about the PyQt mailing list