[Qt-jambi-interest] Memory Leaks - any updates?
Gunnar Sletta
gunnar at trolltech.com
Fri Nov 28 13:01:03 CET 2008
Gunnar Sletta wrote:
> QWidget window = new QWidget();
> QPushButton button = new QPushButton(window) {
> public void disposed() {
> // something...
> }
> }
I see that I completely messed up my own example here.. The proper code
should have been:
class Window extends QWidget {
public Widget() {
QPushButton button = new QPushButton("Hello", window) {
public void disposed() { ... }
}
}
}
The clue is that the child is an inner class of its parent, thus having
an implicit outer-class reference to the toplevel preventing it from
being destroyed.
-
Gunnar
More information about the Qt-jambi-interest
mailing list