diff --git a/src/lay/lay/layApplication.cc b/src/lay/lay/layApplication.cc index a02791ef8..e8650e60d 100644 --- a/src/lay/lay/layApplication.cc +++ b/src/lay/lay/layApplication.cc @@ -1479,6 +1479,19 @@ GuiApplication::initialize () bool GuiApplication::notify (QObject *receiver, QEvent *e) +{ + if (dynamic_cast (e)) { + // NOTE: we don't want recursive paint events - the painters are not reentrant. + // Hence we disable process_events_impl (specifically for progress reporters). + lay::BusySection busy; + return do_notify (receiver, e); + } else { + return do_notify (receiver, e); + } +} + +bool +GuiApplication::do_notify (QObject *receiver, QEvent *e) { bool in_notify = (m_in_notify > 0); diff --git a/src/lay/lay/layApplication.h b/src/lay/lay/layApplication.h index 31dbb6b07..21e06bb43 100644 --- a/src/lay/lay/layApplication.h +++ b/src/lay/lay/layApplication.h @@ -480,6 +480,8 @@ private: MainWindow *mp_mw; gtf::Recorder *mp_recorder; int m_in_notify; + + bool do_notify (QObject *receiver, QEvent *e); }; /** diff --git a/src/lay/lay/layProgress.cc b/src/lay/lay/layProgress.cc index 6450cb541..10e727981 100644 --- a/src/lay/lay/layProgress.cc +++ b/src/lay/lay/layProgress.cc @@ -28,6 +28,7 @@ #include "layProgress.h" #include "layMainWindow.h" #include "layProgressWidget.h" +#include "layApplication.h" #include "tlProgress.h" #include "tlDeferredExecution.h" @@ -211,11 +212,8 @@ ProgressReporter::update_and_yield () void ProgressReporter::process_events () { - // Don't execute deferred methods during progress handling (undesired side effects) - tl::NoDeferredMethods silent; - - if (m_pw_visible && lay::MainWindow::instance () && QApplication::instance ()) { - QApplication::instance ()->processEvents (QEventLoop::AllEvents); + if (m_pw_visible && lay::MainWindow::instance () && lay::ApplicationBase::instance ()) { + lay::ApplicationBase::instance ()->process_events (QEventLoop::AllEvents, true /* no deferred methods */); } }