[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Python has stopped working in PyQt application
From:       Baz Walter <bazwal () ftml ! net>
Date:       2015-03-31 16:00:52
Message-ID: 551AC4B4.80001 () ftml ! net
[Download RAW message or body]

On 31/03/15 13:24, Florian Bruhin wrote:
> * redstone-cold <redstone-cold@163.com> [2015-03-31 09:45:49 +0800]:
>> code here
>> https://bpaste.net/show/7a73adda2a4b
>>
>>
>> After it  running for about half a minute ,then close the window,
>> then the "Python has stopped working" dialog pops up(you had better
>> try more than once. )
>>
>>   I wonder why this happen ?any solution to this ?
>
> Seems like the crash happens in QObject::thread() when exiting Python.
>
> It seems it doesn't happen anymore when doing:
>
>      import sip
>      sip.setdestroyonexit(False)
>
> See:
> http://pyqt.sourceforge.net/Docs/sip4/python_api.html#sip.setdestroyonexit
>
> This is also the default with PyQt5 where I also can't reproduce the
> crash.

Setting the mainwindow as the parent of the systrayicon will ensure the 
objects get deleted in the right order (for both PyQt4 and PyQt5, no 
matter what the state of setdestroyonexit is):

     self.trayIcon = QSystemTrayIcon(self)

-- 
Regards
Baz Walter

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic