[PyQt] core dump in pyqt application
Iván García
capiscuas at gmail.com
Sun Jul 6 13:34:05 BST 2008
Currently the app uses python threads, not pyqt threads, could this be
the reason?
The only thread I'm having now is a logging function:
self.setTitleBarText("Trying to login...")
try:
if self.OSDBServer._login(username, password) :
if not username: username = 'Anonymous'
self.setTitleBarText("Logged as: %s" % username)
elif username: #We try anonymous login in case the normal
user login has failed
self.setTitleBarText("Error logging as: %s. Logging
anonymously..." % username)
if self.OSDBServer._login("", "") :
self.setTitleBarText("Logged as: Anonymous")
else:
self.setTitleBarText("Login: Cannot login.")
except:
self.setTitleBarText("Login: ERROR")
The only interaction of the thread with the pyqt GUI is the
setTitleBarText where it changes the title of the Main App Window.
Andreas Pakulat wrote:
> On 06.07.08 13:16:09, Iván García wrote:
>
>> One of my users just reported this bug:
>>
>> ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread f74470. Receiver 'MainWindow' (of type 'QMainWindow') was created in thread 9a7fc0", file kernel/qcoreapplication.cpp, line 269
>> Cancelado (core dumped)
>>
>> How to avoid this problem? Is there a way to fix the problem within the
>> application code?
>>
>
> Yes, don't use sendEvent across threads, use postEvent. This is not 100%
> clear in the documentation, except that sendEvent is explained to use
> notify() directly. And obviously notify shouldn't be called from a
> different thread.
>
> Andreas
>
>
More information about the PyQt
mailing list