[PyKDE] bug in QObject.emit

Phil Thompson phil at riverbankcomputing.co.uk
Tue Feb 10 23:36:01 GMT 2004


On Tuesday 10 February 2004 9:08 am, Patrick Stinson wrote:
> replicable code, minus debugging output:
>
> ajole at ajole pksampler $ python
> Python 2.3.3 (#1, Jan 27 2004, 10:43:25)
> [GCC 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r3, propolice)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> from qt import *
> >>> class QO(QObject):
>
> ...     def __init__(self):
> ...             QObject.__init__(self)
> ...     def slotEmit(self):
> ...             QObject.emit(self, PYSIGNAL('thisbuggersit'), ())
> ...
>
> >>> a = QApplication([])
> >>> b = QPushButton()
> >>> b = QPushButton(None)
> >>> o = QO()
> >>> QObject.connect(b, SIGNAL('clicked()'), o.slotEmit)
>
> True
>
> >>> b.show()
> >>> a.setMainWidget(b)
> >>> a.exec_loop()
>
> ** click **
>
> Segmentation fault

[snip]

> I know that isn't the indended use of emit(), but it shouldn't seg fault
> anyway...

I know what the problem is, but I want to think a bit about the right fix.

In the meantime, the more conventional...

	self.emit(PYSIGNAL('shouldwork'), ())

...should work.

Thanks,
Phil




More information about the PyQt mailing list