Fixed crash on Linux on startup
This commit is contained in:
parent
2583522e43
commit
b17c829c9a
@ -298,6 +298,7 @@ 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 {
|
||||
@ -308,6 +309,10 @@ 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
|
||||
}
|
||||
});
|
||||
|
||||
@ -3389,10 +3394,9 @@ void Tab::activate_selected_page(std::function<void()> throw_if_canceled)
|
||||
|
||||
bool Tab::tree_sel_change_delayed()
|
||||
{
|
||||
#if 1
|
||||
// There is a bug related to Ubuntu overlay scrollbars, see https://github.com/prusa3d/PrusaSlicer/issues/898 and https://github.com/prusa3d/PrusaSlicer/issues/952.
|
||||
// The issue apparently manifests when Show()ing a window with overlay scrollbars while the UI is frozen. For this reason,
|
||||
// we will Thaw the UI prematurely on Linux. This means destroing the no_updates object prematurely.
|
||||
// There is a bug related to Ubuntu overlay scrollbars, see https://github.com/prusa3d/PrusaSlicer/issues/898 and https://github.com/prusa3d/PrusaSlicer/issues/952.
|
||||
// The issue apparently manifests when Show()ing a window with overlay scrollbars while the UI is frozen. For this reason,
|
||||
// we will Thaw the UI prematurely on Linux. This means destroing the no_updates object prematurely.
|
||||
#ifdef __linux__
|
||||
std::unique_ptr<wxWindowUpdateLocker> no_updates(new wxWindowUpdateLocker(this));
|
||||
#else
|
||||
@ -3401,9 +3405,8 @@ bool Tab::tree_sel_change_delayed()
|
||||
* But under OSX (builds compiled with MacOSX10.14.sdk) wxStaticBitmap rendering is broken without Freeze/Thaw call.
|
||||
*/
|
||||
//#ifdef __WXOSX__ // Use Freeze/Thaw to avoid flickering during clear/activate new page
|
||||
wxWindowUpdateLocker noUpdates(this);
|
||||
wxWindowUpdateLocker noUpdates(this);
|
||||
//#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Page* page = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user