[PyQt] Occasionally getting QBuffer in QApplication.focusChanged slot

Phil Thompson phil at riverbankcomputing.com
Wed May 11 10:36:28 BST 2016


On 11 May 2016, at 9:45 am, Florian Bruhin <me at the-compiler.org> wrote:
> 
> * Phil Thompson <phil at riverbankcomputing.com> [2016-05-11 09:31:22 +0100]:
>> On 11 May 2016, at 7:47 am, Florian Bruhin <me at the-compiler.org> wrote:
>>> 
>>> 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!
>> 
>> It "can't" happen. It would be interesting to know how PyQt/sip were built (ie. distro version etc).
> 
> Did you intend to not Cc the list?

No.

> All of them happened on a 64bit Archlinux, you can find the PKGBUILDs
> used to build Qt/PyQt/sip here:
> 
> https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/qt5-base
> https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/pyqt5
> https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/sip

I'd say that was a bit suspicious.

Phil


More information about the PyQt mailing list