From kde-devel Mon Aug 02 07:43:14 1999 From: Leon Widdershoven Date: Mon, 02 Aug 1999 07:43:14 +0000 To: kde-devel Subject: Re: Memory question X-MARC-Message: https://marc.info/?l=kde-devel&m=93358681126951 From the Qt documentation (qdialog.html): main() { (Open 1) Modal m; if ( m.exec() ) { (Open 2) // ok was pressed, then fetch the interesting dialog data } (Close 2) } (Close 1) In this example, Modal m; is not created using new, and will thus be deleted when it runs out of context. Since it is opened after (Open 1) it will be deleted automatically at "} (close 1)". If you want it to be deleted after (Close 2) the you should write the following: Modal *m = new Modal; if ( m->exec() ) { // Use m; } delete m; Regards, Leon Herwin Jan Steehouwer wrote: > > On Mon, 2 Aug 1999, Uwe Thiem wrote: > > > On Sun, 1 Aug 1999, Herwin Jan Steehouwer wrote: > > > > > I have a little memory question, when i make Dialogs or TabDialog etc, > > > they are closed with accept(), but that is not removing the dialog. > > > > > > How can i be shure the dialog is removed from memory, because the memory > > > is increasing every time i open a window !? > > > > There is someplace in your program where you create the dialog with "new" > > and then call yourDialog->exec(). When that call returns you delete > > the dialog with ... well ... "delete". ;-) > > Yes, but what about Modal dialogs ? > like QDialog(this, name, TRUE); ? > > they can't be run with exec() ! how can i delte those ? > > tanx ! > > HJ > > > > Uwe > > > > ------------------------------------------------------------------------- > > Uwe Thiem Tel: +264 - 061 - 244511 > > P.O.Box 30955 Fax: +264 - 061 - 244511 > > Windhoek Email: uwe@uwix.alt.na > > Republic of Namibia uwe@kde.org > > http://www.kde.org > > ********************************** > > You can still escape from the GATES of hell: Use KDE! > > ------------------------------------------------------------------------- > > > > > > > > > > Herwin Jan Steehouwer > herwinjs@palet.nl http://www.caiw.nl/~herwinjs > steehouwer@kde.org KDE developer http://www.kde.org -- In a world without walls and fences, l.widdershoven@fz-juelich.de who needs Windows and Gates? Institute of Plasma physics (IPP) Forschungszentrum Juelich GmbH