[PyQt] OSX segfault emitting signal with dict argument

Phil Thompson phil at riverbankcomputing.com
Fri Apr 23 16:05:31 BST 2010


On Tue, 20 Apr 2010 18:32:43 +0100, Jugdish <jugdizh at gmail.com> wrote:
> I've tested the following bit of code under these 2 setups:
> 
> 1. Mac OSX 10.6.2 Intel
>    Python 2.6.5
>    Qt 4.6.2
>    PyQt 4.7.2
> 
> 2. GNU/Linux x64 Fedora 8
>    Python 2.6.2
>    Qt 4.6.2
>    PyQt 4.7
> 
> The code runs fine on the Linux setup, but results in a segfault on OSX.
> Interestingly, if I declare the signal as pyqtSignal(object) rather than
> pyqtSignal(dict), the segfault doesn't happen. Also, if I change the
> dictionary's key from an integer to a string, the segfault goes away.
> 
> #######################################
> from PyQt4 import QtCore
> 
> class A(QtCore.QObject):
>     foo = QtCore.pyqtSignal(dict)
> 
> class B(QtCore.QObject):
>     def doStuff(self, obj):
>         print "got object", obj
> 
> a = A()
> b = B()
> a.foo.connect(b.doStuff)
> a.foo.emit({0: "value"})

It's actually broken on all platforms - fixed in tonight's snapshot.

Thanks,
Phil


More information about the PyQt mailing list