[PyKDE] Crashes with emit() in 3.2 (thread related?)
Andreas Gerstlauer
gerstl at ics.uci.edu
Thu May 9 00:42:00 BST 2002
Hi!
I just installed the latest PyQt 3.2 together with Qt 3.0.4 and
Python 2.2.1 under X11. However, my application doesn't work any more,
I get hard crashes (segfaults).
I managed to isolate the problem and it seems
that emitting a Qt signal (via SIGNAL(), i.e. not a PYSIGNAL)
doesn't work any more. I created a little test program, see
below. The output I get here is:
% python test.py
Emitting signal...
My Slot
<qt.QListViewItem instance at 0x1b0be8>
0
test
Fatal Python error: PyThreadState_Get: no current thread
Abort
In some other cases in my application I also get different
error messages (or no message at all, just a segfault),
all when trying to call emit(SIGNAL(...), (..)).
I don't know, I am not aware of doing anything wrong or
unusual, esp. since it used to work with the previous PyQt
version 3.1, patch 1. Looks like a bug to me...
Any ideas? For now I am converting everything to PYSIGNALS
instead, I guess.
Andreas
-------------- next part --------------
#! python
import sys
from qt import *
class MyApplication(QApplication):
def __init__(self, args):
QApplication.__init__(self, args)
def mySlot(self, item, col, string):
print "My Slot"
print item
print col
print string
class MyListView(QListView):
def __init__(self, parent = None):
QListView.__init__(self, parent)
self.item = QListViewItem(self)
def emitSignal(self):
print "Emitting signal..."
self.emit(SIGNAL("itemRenamed(QListViewItem*,int,const QString&)"),
(self.item, 0, QString("test")))
print "Done emitting"
if __name__ == "__main__":
a = MyApplication(sys.argv)
a.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
w = MyListView()
a.setMainWidget(w)
a.connect(w, SIGNAL("itemRenamed(QListViewItem*,int,const QString&)"),
a.mySlot)
QTimer.singleShot(2000, w.emitSignal)
w.show()
a.exec_loop()
More information about the PyQt
mailing list