PyQT-application crash when shutting down

Albert Hofkamp hat at se-46.wpa.wtb.tue.nl
Mon Jan 27 17:56:41 CET 2003


On Sun, 26 Jan 2003 14:05:26 -0700, Andrew Dalke <adalke at mindspring.com> wrote:
>> The application seems to be working fine, but when I press the 'Quit'
>> button (which sends a 'clicked' signal to the 'quit' slot of the main
>> application), I get a "segmentation fault".
>> Below is a stripped-down application that demonstrates the problem (at
>> least at my machine):
> 
>> if __name__ == '__main__':
>>     app=QApplication(sys.argv)
>>     aw=ApplicationWindow()
>>     app.setMainWidget(aw)
>>     app.connect(aw._quit,SIGNAL("clicked()"),app,SLOT("quit()"))
>>     aw.show()
>>     app.exec_loop()
>> 
>> I don't understand why this happens. If the application is closed with the
>> 'close window' button, it exits without problems.
>> 
>> Any ideas?
> 
> I get similar behaviour.  I think it's because the deallocator for
> app and aw are in indefinite order, but Qt requires aw to be deallocated
> first.  I end up writing my scripts like this

Hmm, so 'del aw' as the last statement would also work then ?

> def main(app):
>      aw=ApplicationWindow()
>      app.setMainWidget(aw)
>      app.connect(aw._quit,SIGNAL("clicked()"),app,SLOT("quit()"))
>      aw.show()
>      app.exec_loop()
> 
> if __name__ == "__main__":
>      app = QApplication(sys.argv)
>      main(app)

Thank you very much!!
I was hoping that a simple fix would be available for my current version.

If this works, we will have one happy system administrator (since he has 40
machines less to upgrade to a new PyQt :-) ).


Albert
-- 
Unlike popular belief, the .doc format is not an open publically available format.




More information about the Python-list mailing list