Skip to content

Commit

Permalink
Prevent segfault upon exit if dialogs left over (bsc#1074596)
Browse files Browse the repository at this point in the history
  • Loading branch information
shundhammer committed Feb 1, 2018
1 parent a4ff748 commit d9e2349
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/YQUI.cc
Expand Up @@ -339,7 +339,7 @@ void YQUI::processCommandLineArgs( int argc, char **argv )

YQUI::~YQUI()
{
yuiDebug() <<"Closing down Qt UI." << std::endl;
yuiMilestone() <<"Closing down Qt UI." << std::endl;

// Intentionally NOT calling dlclose() to libqt-mt
// (see constructor for explanation)
Expand All @@ -356,10 +356,20 @@ YQUI::~YQUI()
void
YQUI::uiThreadDestructor()
{
yuiMilestone() <<"Destroying UI thread" << std::endl;

if ( qApp ) // might already be reset to 0 internally from Qt
{
qApp->exit();
delete qApp;
if ( YDialog::openDialogsCount() > 0 )
{
yuiError() << YDialog::openDialogsCount() << " open dialogs left over" << endl;
yuiError() << "Topmost dialog:" << endl;
YDialog::topmostDialog()->dumpWidgetTree();
}

YDialog::deleteAllDialogs();
qApp->exit();
qApp->deleteLater();
}
}

Expand Down

0 comments on commit d9e2349

Please sign in to comment.