mmg: use app->SafeYield() instead of while(app->Pending()) app->Dispatch()

The latter seems to hang endlessly on Mac OS.
This commit is contained in:
Moritz Bunkus 2014-09-17 22:44:43 +02:00
parent ae9b45d7a8
commit 8c61d83c54
2 changed files with 14 additions and 5 deletions

View File

@ -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;
}

View File

@ -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_c> wx_kax_analyzer_cptr;