Re: free dialog memory



Maybe I'm not getting your question, but it should be done when it
leaves a context.

void what::ever () {
  Dialog myDialog("My Dialog");
  myDialog.run();
}
// myDialog no longer exists.

If you want to be able to close it from anywhere in it's parent
window, I would make it a pointer in the parent window class...
...
private:
  Dialog * myDialog;
...

Then do like this...

void dialogLauncherWindow::showDialog () {
  if(NULL != myDialog)
    return;

  myDialog = new Dialog("My Dialog");
  myDialog->run();
  delete myDialog;
  myDialog = NULL;
}

void dialogLauncherWindow::clickAButtonToCloseDialog () {
  if(NULL == myDialog)
    return;

  myDialog->hide();
}

I think all of that is valid code, I sort of just wrote it right here
in the email.  It's close at least.

- John Hobbs

On Fri, Jul 18, 2008 at 12:02 PM, Jean-Loup Defaisse <jloupdef gmail com> wrote:
> Hello,
> How can i close a Dialog (of any type: MessageDialog, FileChooserDialog ..)
> and free the memory which it was using (not just hide the dialog). I can't
> find the answer on the web but there certainly is a simple solution.
>
> Thanks in advance.
>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>
>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]