[PyQt] [PyQt 4.5] Crash emit signal

Phil Thompson phil at riverbankcomputing.com
Tue Apr 14 11:23:54 BST 2009


On Mon, 13 Apr 2009 11:31:55 +0700, Alexandr N Zamaraev <tonal at promsoft.ru>
wrote:
> Os Windows Vista Home Ru + sp1
> g++ (GCC) 3.4.5 (mingw-vista special r3)
> Qt 4.5 (self build)
> sip-4.8-snapshot-20090409 (self build)
> PyQt-win-gpl-4.5-snapshot-20090411.zip (self build)
> 
> 
> P.S. We found this in the code code:
> def connectWidget(self, widget):
>     widget.signalA.connect(self.signalA)
>     widget.signalB.connect(self.signalB)
>     widget.signalC.connect(self.signalC)
> 
> Maybe it makes sense to change the connect as follows:
> class pyqtSignal (...):
>    def connect(self, arg):
>      if hasattr(arg, self.name):
>        arg = getattr(arg, self.name):
>      elif hasattr (arg, '__class__') and hasattr (arg, '_%s__%s' % 
> (arg.__class__.__name__, self.name):
>        #find private atts with name '__on_signame'
>        arg = getattr(arg, '_%s__on_%s' % (arg.__class__.__name__,
>        self.name)
>      #remaining processing

The segfault (which I'll fix) is caused by a bug in the redirect_signal()
function in your test code. You are connecting a signal to itself and
ignoring the 'dst' argument.

Phil


More information about the PyQt mailing list