[PyKDE] main-loop and segfault

Willi Richert mennosimons at gmx.net
Mon Jul 1 00:39:00 BST 2002


Hi,

I stumbled across the following crazy behaviour: If the application is 
executed from within a main()-method and then exit it prints only "1" and 
after that issues a segmentation fault:

def main():
    a=QApplication(sys.argv)
    w=MyWindow()
    a.setMainWidget(w)
    w.resize(400,500)
    w.show()
    a.exec_loop()
    print "1"

if __name__ == '__main__':
    main()
    print "2"
    
print "3"


However, if QApplication is executed in the top level block it works fine. 
Does anybody know, why?

Thanks,
willi


-- 
Vieles ist einfach, der Rest zweifach.




More information about the PyQt mailing list