From 6871c2ccd8d77bb69c0197b0b4de1482180d783f Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Wed, 7 Oct 2020 16:15:07 +0200 Subject: [PATCH] Fixed updating of pages on startup, reverted changes from b17c829 The second commit should be no longer needed, the CallAfter cause crashes on Linux when switching technologies --- src/slic3r/GUI/Tab.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 3a28b2766..9a037d9d7 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -303,7 +303,6 @@ void Tab::create_preset_tab() // so that the cursor jumps to the last item. m_treectrl->Bind(wxEVT_TREE_SEL_CHANGED, [this](wxTreeEvent&) { if (!m_disable_tree_sel_changed_event && !m_pages.empty()) { -#ifdef WIN32 if (m_page_switch_running) m_page_switch_planned = true; else { @@ -314,10 +313,6 @@ void Tab::create_preset_tab() } while (this->tree_sel_change_delayed()); m_page_switch_running = false; } -#else - // Crashes on Linux on start-up without CallAfter. - this->CallAfter([this]() { this->tree_sel_change_delayed(); }); -#endif } }); @@ -357,6 +352,13 @@ void Tab::create_preset_tab() // Initialize the DynamicPrintConfig by default keys/values. build(); + + // ys_FIXME: Following should not be needed, the function will be called later + // (update_mode->update_visibility->rebuild_page_tree). This does not work, during the + // second call of rebuild_page_tree m_treectrl->GetFirstVisibleItem(); returns zero + // for some unknown reason (and the page is not refreshed until user does a selection). + rebuild_page_tree(); + m_completed = true; }