From 984b1bc1c16f24fe3cf9300582f027df3d6948f9 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Thu, 17 Jan 2019 17:41:07 +0100 Subject: [PATCH] GUI_App: Remove custom CallAfter --- src/slic3r/GUI/GUI_App.cpp | 29 ----------------------------- src/slic3r/GUI/GUI_App.hpp | 6 ------ 2 files changed, 35 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 861312f82..9991fee75 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -164,27 +164,8 @@ bool GUI_App::OnInit() // to correct later layouts }); - // This makes CallAfter() work Bind(wxEVT_IDLE, [this](wxIdleEvent& event) { - std::function cur_cb{ nullptr }; - // try to get the mutex. If we can't, just skip this idle event and get the next one. - if (!callback_register.try_lock()) return; - // pop callback - if (m_cb.size() != 0) { - cur_cb = m_cb.top(); - m_cb.pop(); - } - // unlock mutex - this->callback_register.unlock(); - - try { // call the function if it's not nullptr; - if (cur_cb != nullptr) cur_cb(); - } - catch (std::exception& e) { - std::cerr << "Exception thrown: " << e.what() << std::endl; - } - if (app_config->dirty()) app_config->save(); @@ -420,16 +401,6 @@ void GUI_App::import_model(wxWindow *parent, wxArrayString& input_files) dialog.GetPaths(input_files); } -void GUI_App::CallAfter(std::function cb) -{ - // set mutex - callback_register.lock(); - // push function onto stack - m_cb.emplace(cb); - // unset mutex - callback_register.unlock(); -} - // select language from the list of installed languages bool GUI_App::select_language( wxArrayString & names, wxArrayLong & identifiers) diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index 6d81b3795..c398c449e 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -73,11 +73,6 @@ class GUI_App : public wxApp { bool app_conf_exists{ false }; - // Lock to guard the callback stack - std::mutex callback_register; - // callbacks registered to run during idle event. - std::stack> m_cb{}; - wxColour m_color_label_modified; wxColour m_color_label_sys; wxColour m_color_label_default; @@ -124,7 +119,6 @@ public: void persist_window_geometry(wxTopLevelWindow *window); void update_ui_from_settings(); - void CallAfter(std::function cb); bool select_language(wxArrayString & names, wxArrayLong & identifiers); bool load_language();