[PyQt] BUG: pyqtSignal('QString') vs pyqtSignal(['QString']) causes
crash
Demetrius Cassidy
dcassidy36 at mass.rr.com
Fri Apr 10 22:58:30 BST 2009
I am not sure if passing a string by itself to pyqtSignal is correct, but
shoulden't it raise an exception instead of crashing? I don't see why we
can't use this form instead.
If I use the latter form of pyqtSignal(['QString']), passing it a list of
strings, everything works great. If I pass it a quoted string, I get a crash
in QtCore.pyd using the latest nightly build (0409)
Simple test case, replace pyqtSignal('QString') with pyqtSignal(['QString'])
and it works OK.
import sys
from PyQt4 import QtGui, QtCore
class mainDlg(QtGui.QDialog):
clickEvent = QtCore.pyqtSignal('QString')
def __init__(self):
QtGui.QDialog.__init__(self)
self.setObjectName('Dialog')
self.resize(120, 120)
self.crashButton = QtGui.QPushButton()
self.crashButton.setText('Crash!')
self.verticalLayout = QtGui.QVBoxLayout(self)
self.verticalLayout.setObjectName("verticalLayout")
self.verticalLayout.addWidget(self.crashButton)
QtCore.QMetaObject.connectSlotsByName(self)
self.crashButton.clicked.connect(self.doCrash)
self.clickEvent.connect(self.OnEvent)
def doCrash(self):
self.clickEvent.emit('omgwtfbbq') <- crashes here
def OnEvent(self, txt):
pass
app = QtGui.QApplication(sys.argv)
dlg = mainDlg()
dlg.show()
--
View this message in context: http://www.nabble.com/BUG%3A-pyqtSignal%28%27QString%27%29-vs-pyqtSignal%28-%27QString%27-%29-causes-crash-tp22995320p22995320.html
Sent from the PyQt mailing list archive at Nabble.com.
More information about the PyQt
mailing list