#3964 - Attempt to fix crash when closing on Linux (Debian unstable)

This commit is contained in:
enricoturri1966 2020-04-01 09:58:31 +02:00
parent daa6dd0a25
commit 1f3046f65d
4 changed files with 23 additions and 7 deletions

View File

@ -44,19 +44,15 @@
// Enable fix for dragging mouse event handling for gizmobar // Enable fix for dragging mouse event handling for gizmobar
#define ENABLE_GIZMO_TOOLBAR_DRAGGING_FIX (1 && ENABLE_2_2_0_FINAL) #define ENABLE_GIZMO_TOOLBAR_DRAGGING_FIX (1 && ENABLE_2_2_0_FINAL)
//============
// 2.3.0 techs
//============
#define ENABLE_2_3_0 1
// Enable rendering of objects colored by facets' slope
#define ENABLE_SLOPE_RENDERING (1 && ENABLE_2_3_0)
//=================== //===================
// 2.3.0.alpha1 techs // 2.3.0.alpha1 techs
//=================== //===================
#define ENABLE_2_3_0_ALPHA1 1 #define ENABLE_2_3_0_ALPHA1 1
// Enable rendering of objects colored by facets' slope
#define ENABLE_SLOPE_RENDERING (1 && ENABLE_2_3_0_ALPHA1)
// Moves GLCanvas3DManager from being a static member of _3DScene to be a normal member of GUI_App // Moves GLCanvas3DManager from being a static member of _3DScene to be a normal member of GUI_App
#define ENABLE_NON_STATIC_CANVAS_MANAGER (1 && ENABLE_2_3_0_ALPHA1) #define ENABLE_NON_STATIC_CANVAS_MANAGER (1 && ENABLE_2_3_0_ALPHA1)

View File

@ -214,6 +214,10 @@ void MainFrame::shutdown()
// when closing the application using Command+Q, a mouse event is triggered after this lambda is completed, // when closing the application using Command+Q, a mouse event is triggered after this lambda is completed,
// causing a crash // causing a crash
if (m_plater) m_plater->unbind_canvas_event_handlers(); if (m_plater) m_plater->unbind_canvas_event_handlers();
// Cleanup of canvases' volumes needs to be done here or a crash may happen on some Linux Debian flavours
// see: https://github.com/prusa3d/PrusaSlicer/issues/3964
if (m_plater) m_plater->reset_canvas_volumes();
#endif // ENABLE_NON_STATIC_CANVAS_MANAGER #endif // ENABLE_NON_STATIC_CANVAS_MANAGER
// Weird things happen as the Paint messages are floating around the windows being destructed. // Weird things happen as the Paint messages are floating around the windows being destructed.

View File

@ -1834,6 +1834,7 @@ struct Plater::priv
GLCanvas3D* get_current_canvas3D(); GLCanvas3D* get_current_canvas3D();
#if ENABLE_NON_STATIC_CANVAS_MANAGER #if ENABLE_NON_STATIC_CANVAS_MANAGER
void unbind_canvas_event_handlers(); void unbind_canvas_event_handlers();
void reset_canvas_volumes();
#endif // ENABLE_NON_STATIC_CANVAS_MANAGER #endif // ENABLE_NON_STATIC_CANVAS_MANAGER
bool init_view_toolbar(); bool init_view_toolbar();
@ -4084,6 +4085,15 @@ void Plater::priv::unbind_canvas_event_handlers()
if (preview != nullptr) if (preview != nullptr)
preview->get_canvas3d()->unbind_event_handlers(); preview->get_canvas3d()->unbind_event_handlers();
} }
void Plater::priv::reset_canvas_volumes()
{
if (view3D != nullptr)
view3D->get_canvas3d()->reset_volumes();
if (preview != nullptr)
preview->get_canvas3d()->reset_volumes();
}
#endif // ENABLE_NON_STATIC_CANVAS_MANAGER #endif // ENABLE_NON_STATIC_CANVAS_MANAGER
bool Plater::priv::init_view_toolbar() bool Plater::priv::init_view_toolbar()
@ -5500,6 +5510,11 @@ void Plater::unbind_canvas_event_handlers()
{ {
p->unbind_canvas_event_handlers(); p->unbind_canvas_event_handlers();
} }
void Plater::reset_canvas_volumes()
{
p->reset_canvas_volumes();
}
#endif // ENABLE_NON_STATIC_CANVAS_MANAGER #endif // ENABLE_NON_STATIC_CANVAS_MANAGER
PrinterTechnology Plater::printer_technology() const PrinterTechnology Plater::printer_technology() const

View File

@ -262,6 +262,7 @@ public:
void set_current_canvas_as_dirty(); void set_current_canvas_as_dirty();
#if ENABLE_NON_STATIC_CANVAS_MANAGER #if ENABLE_NON_STATIC_CANVAS_MANAGER
void unbind_canvas_event_handlers(); void unbind_canvas_event_handlers();
void reset_canvas_volumes();
#endif // ENABLE_NON_STATIC_CANVAS_MANAGER #endif // ENABLE_NON_STATIC_CANVAS_MANAGER
PrinterTechnology printer_technology() const; PrinterTechnology printer_technology() const;