diff --git a/src/mmg/wx_kax_analyzer.cpp b/src/mmg/wx_kax_analyzer.cpp index cc5eac08d..77ebf8abd 100644 --- a/src/mmg/wx_kax_analyzer.cpp +++ b/src/mmg/wx_kax_analyzer.cpp @@ -31,20 +31,28 @@ wx_kax_analyzer_c::wx_kax_analyzer_c(wxWindow *parent, wx_kax_analyzer_c::~wx_kax_analyzer_c() { } +void +wx_kax_analyzer_c::yield() { +#if wxCHECK_VERSION(2, 9, 0) + app->SafeYield(m_prog_dlg, false); +#else + while (app->Pending()) + app->Dispatch(); +#endif +} + void wx_kax_analyzer_c::show_progress_start(int64_t) { m_prog_dlg = new wxProgressDialog(Z("Analysis is running"), Z("The file is being analyzed."), 100, m_parent, wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_REMAINING_TIME); - - while (app->Pending()) - app->Dispatch(); + yield(); } bool wx_kax_analyzer_c::show_progress_running(int percentage) { bool aborted = !m_prog_dlg->Update(percentage); - while (app->Pending()) - app->Dispatch(); + + yield(); return !aborted; } diff --git a/src/mmg/wx_kax_analyzer.h b/src/mmg/wx_kax_analyzer.h index 672993ee7..6c4edf18e 100644 --- a/src/mmg/wx_kax_analyzer.h +++ b/src/mmg/wx_kax_analyzer.h @@ -40,6 +40,7 @@ public: protected: virtual void _log_debug_message(const std::string &message); + virtual void yield(); }; typedef std::shared_ptr wx_kax_analyzer_cptr;