Exit DialogWindow::showModalDialog


When using a modal window with DialogWindow::showModalDialog I tried to exit this programmatically with:

This works great in Windows, but creates a crash on a Mac if the content component is deleted directly after the exiting the modal state.

I found that this works better:

findParentComponentOfClass ((DialogWindow*) 0)->setVisible(false);

Is this a correct way to exit the modal state programmatically?



Either one should be ok as long as you’re careful about dangling pointers. More likely that you were lucky to get away with it on windows rather than there being a problem on the mac.