Fredrik Lundh <fredrik <at> pythonware.com> writes: > > Baz Walter wrote: > > > It's hard to supply an example for this, since it is local to the machine I am > > using. The startup module would look something like this: > > would look, or does look? if it doesn't look like this, what else does > it contain?
What I did was create a minimal version of the module which still exhibits the same behaviour (for me, that is). Basically, QWidget in the example below replaces my MainWindow class. > > #!/usr/local/bin/python > > > > if __name__ == '__main__': > > > > import sys > > from qt import QApplication, QWidget > > > > application = QApplication(sys.argv) > > mainwindow = QWidget() > > application.setMainWidget(mainwindow) > > mainwindow.show() > > sys.exit(application.exec_loop()) > > > > If I change the name 'mainwindow' to 'mainwidget', the widget it refers to does > > not get destroyed; when I change it back again, it does get destroyed. > > Otherwise, the program runs completely normally. > > I don't see any code in there that destroys the widget, and I also don't > see any code in there that creates more than one instance of the main > widget. Qt will try to destroy all widgets that are linked together in the object hierarchy. > what do you do to run the code, and how to you measure leakage? I run it with: python app.py -widgetcount The widgetcount switch is a Qt facility which counts how many widgets are created and how many destroyed. Before changing the name 'mainwindow' to 'mainwidget' it reports: Widgets left: 0 Max widgets: 2 Widgets left: 0 Max widgets: 149 (full program) Afterwards it reports: Widgets left: 1 Max widgets: 2 Widgets left: 146 Max widgets: 149 (full program) > is the name "mainwidget" used for some other purpose in your application? No -- http://mail.python.org/mailman/listinfo/python-list