From e8a875ccb59b16a0c15dcb35f09212b87ad82cad Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 9 Feb 2020 01:35:44 +0100 Subject: [PATCH] WIP: further refactoring. --- src/lay/lay/layApplication.cc | 8 ++++++++ src/lay/lay/layMainWindow.cc | 8 -------- src/laybasic/laybasic/layDispatcher.cc | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/lay/lay/layApplication.cc b/src/lay/lay/layApplication.cc index 14081b137..385488c2b 100644 --- a/src/lay/lay/layApplication.cc +++ b/src/lay/lay/layApplication.cc @@ -1412,6 +1412,14 @@ GuiApplication::exec () void GuiApplication::shutdown () { + // avoid deferred execution later on where there isn't a valid main window anymore + // (problem case: showing a dialog inside main windows's destroyed signal - this will + // process events and trigger execution if not disabled) + if (! tl::DeferredMethodScheduler::instance ()->is_disabled ()) { + tl::DeferredMethodScheduler::instance ()->execute (); + } + tl::DeferredMethodScheduler::instance ()->enable (false); + if (mp_mw) { delete mp_mw; mp_mw = 0; diff --git a/src/lay/lay/layMainWindow.cc b/src/lay/lay/layMainWindow.cc index 36df34d81..0ede5654d 100644 --- a/src/lay/lay/layMainWindow.cc +++ b/src/lay/lay/layMainWindow.cc @@ -692,14 +692,6 @@ MainWindow::MainWindow (QApplication *app, lay::Plugin *plugin_parent, const cha MainWindow::~MainWindow () { - // avoid deferred execution later on where there isn't a valid main window anymore - // (problem case: showing a dialog inside main windows's destroyed signal - this will - // process events and trigger execution if not disabled) - if (! tl::DeferredMethodScheduler::instance ()->is_disabled ()) { - tl::DeferredMethodScheduler::instance ()->execute (); - } - tl::DeferredMethodScheduler::instance ()->enable (false); - lay::register_help_handler (0, 0, 0); // since the configuration actions unregister themselves, we need to do this before the main diff --git a/src/laybasic/laybasic/layDispatcher.cc b/src/laybasic/laybasic/layDispatcher.cc index b32fbf4ad..70b664418 100644 --- a/src/laybasic/laybasic/layDispatcher.cc +++ b/src/laybasic/laybasic/layDispatcher.cc @@ -38,7 +38,7 @@ Dispatcher::Dispatcher (Plugin *parent, bool standalone) : Plugin (parent, standalone), m_menu (this) { - if (! parent) { + if (! parent && ! ms_dispatcher_instance) { ms_dispatcher_instance = this; } }