From c3ea735bc8eb9a0b7bcddc0063366d51ce20acb5 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Tue, 5 Feb 2019 18:12:42 +0100 Subject: [PATCH] Fix usage of CallAfter vs modal dialogs in slic3r.cpp, fix #1778 --- src/slic3r.cpp | 3 +++ src/slic3r/GUI/GUI_App.cpp | 2 +- src/slic3r/GUI/GUI_App.hpp | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/slic3r.cpp b/src/slic3r.cpp index 62b56f7ff..9a124c73c 100644 --- a/src/slic3r.cpp +++ b/src/slic3r.cpp @@ -131,6 +131,9 @@ int main(int argc, char **argv) GUI::GUI_App *gui = new GUI::GUI_App(); GUI::GUI_App::SetInstance(gui); gui->CallAfter([gui, &input_files, &cli_config, &extra_config, &print_config] { + if (! gui->initialized()) { + return; + } #if 0 // Load the cummulative config over the currently active profiles. //FIXME if multiple configs are loaded, only the last one will have an effect. diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 056062cf4..fe96aaa80 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -197,7 +197,7 @@ bool GUI_App::OnInit() mainframe->Show(true); - return true; + return m_initialized = true; } unsigned GUI_App::get_colour_approx_luma(const wxColour &colour) diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index 79da4531d..43938b66a 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -71,6 +71,7 @@ static wxString dots("…", wxConvUTF8); class GUI_App : public wxApp { + bool m_initialized { false }; bool app_conf_exists{ false }; wxColour m_color_label_modified; @@ -90,6 +91,7 @@ class GUI_App : public wxApp public: bool OnInit() override; + bool initialized() const { return m_initialized; } GUI_App();