Segmentation fault fix

This commit is contained in:
Markus Gans 2016-07-28 01:04:27 +02:00
parent 94c297ba88
commit d3f5979873
4 changed files with 14 additions and 7 deletions

View File

@ -42,18 +42,20 @@ FDialog::FDialog (const FString& txt, FWidget* parent)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FDialog::~FDialog() // destructor FDialog::~FDialog() // destructor
{ {
FApplication* fapp; FApplication* fapp = static_cast<FApplication*>(getRootWidget());
bool is_quit = fapp->isQuit();
delete dialog_menu; delete dialog_menu;
dgl_menuitem = 0; dgl_menuitem = 0;
delete accelerator_list; delete accelerator_list;
accelerator_list = 0; accelerator_list = 0;
activatePrevWindow();
if ( ! is_quit )
switchToPrevWindow();
delWindow(this); delWindow(this);
delDialog(this); delDialog(this);
fapp = static_cast<FApplication*>(getRootWidget());
if ( ! fapp->quit_now ) if ( ! is_quit )
{ {
const FRect& geometry = getGeometryGlobalShadow(); const FRect& geometry = getGeometryGlobalShadow();
restoreVTerm (geometry); restoreVTerm (geometry);

View File

@ -69,7 +69,11 @@ FMenu::FMenu (const char* txt, FWidget* parent)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMenu::~FMenu() FMenu::~FMenu()
{ {
activatePrevWindow(); FApplication* fapp = static_cast<FApplication*>(getRootWidget());
if ( ! fapp->isQuit() )
switchToPrevWindow();
delWindow(this); delWindow(this);
const FRect& geometry = getGeometryGlobalShadow(); const FRect& geometry = getGeometryGlobalShadow();

View File

@ -177,6 +177,7 @@ FStatusBar::~FStatusBar()
iter = keylist.erase(iter); iter = keylist.erase(iter);
} }
} }
setStatusBar(0);
} }

View File

@ -537,7 +537,7 @@ void FWidget::setStatusBar (FStatusBar* sbar)
if ( ! sbar || statusbar == sbar ) if ( ! sbar || statusbar == sbar )
return; return;
if ( statusbar ) if ( statusbar && sbar != 0 )
delete statusbar; delete statusbar;
statusbar = sbar; statusbar = sbar;