Fix re-entrant render() calls, add an assert to enforce
This commit is contained in:
parent
0bdbd3ee63
commit
f5080ea7f5
3 changed files with 12 additions and 3 deletions
|
@ -7,6 +7,7 @@
|
||||||
#include "libslic3r/PrintConfig.hpp"
|
#include "libslic3r/PrintConfig.hpp"
|
||||||
#include "libslic3r/GCode/PreviewData.hpp"
|
#include "libslic3r/GCode/PreviewData.hpp"
|
||||||
#include "libslic3r/Geometry.hpp"
|
#include "libslic3r/Geometry.hpp"
|
||||||
|
#include "libslic3r/Utils.hpp"
|
||||||
#include "slic3r/GUI/3DScene.hpp"
|
#include "slic3r/GUI/3DScene.hpp"
|
||||||
#include "slic3r/GUI/BackgroundSlicingProcess.hpp"
|
#include "slic3r/GUI/BackgroundSlicingProcess.hpp"
|
||||||
#include "slic3r/GUI/GLShader.hpp"
|
#include "slic3r/GUI/GLShader.hpp"
|
||||||
|
@ -26,6 +27,7 @@
|
||||||
#include <wx/image.h>
|
#include <wx/image.h>
|
||||||
#include <wx/settings.h>
|
#include <wx/settings.h>
|
||||||
#include <wx/tooltip.h>
|
#include <wx/tooltip.h>
|
||||||
|
#include <wx/debug.h>
|
||||||
|
|
||||||
// Print now includes tbb, and tbb includes Windows. This breaks compilation of wxWidgets if included before wx.
|
// Print now includes tbb, and tbb includes Windows. This breaks compilation of wxWidgets if included before wx.
|
||||||
#include "libslic3r/Print.hpp"
|
#include "libslic3r/Print.hpp"
|
||||||
|
@ -3311,6 +3313,7 @@ wxDEFINE_EVENT(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED, SimpleEvent);
|
||||||
GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas)
|
GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas)
|
||||||
: m_canvas(canvas)
|
: m_canvas(canvas)
|
||||||
, m_context(nullptr)
|
, m_context(nullptr)
|
||||||
|
, m_in_render(false)
|
||||||
, m_toolbar(*this)
|
, m_toolbar(*this)
|
||||||
, m_use_clipping_planes(false)
|
, m_use_clipping_planes(false)
|
||||||
, m_config(nullptr)
|
, m_config(nullptr)
|
||||||
|
@ -3737,6 +3740,11 @@ bool GLCanvas3D::gizmo_reset_rect_contains(const GLCanvas3D& canvas, float x, fl
|
||||||
|
|
||||||
void GLCanvas3D::render()
|
void GLCanvas3D::render()
|
||||||
{
|
{
|
||||||
|
wxCHECK_RET(!m_in_render, "GLCanvas3D::render() called recursively");
|
||||||
|
m_in_render = true;
|
||||||
|
Slic3r::ScopeGuard in_render_guard([this]() { m_in_render = false; });
|
||||||
|
(void)in_render_guard;
|
||||||
|
|
||||||
if (m_canvas == nullptr)
|
if (m_canvas == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -717,6 +717,7 @@ private:
|
||||||
|
|
||||||
wxGLCanvas* m_canvas;
|
wxGLCanvas* m_canvas;
|
||||||
wxGLContext* m_context;
|
wxGLContext* m_context;
|
||||||
|
bool m_in_render;
|
||||||
LegendTexture m_legend_texture;
|
LegendTexture m_legend_texture;
|
||||||
WarningTexture m_warning_texture;
|
WarningTexture m_warning_texture;
|
||||||
wxTimer m_timer;
|
wxTimer m_timer;
|
||||||
|
|
|
@ -1361,7 +1361,7 @@ void ObjectList::update_selections_on_canvas()
|
||||||
const int sel_cnt = GetSelectedItemsCount();
|
const int sel_cnt = GetSelectedItemsCount();
|
||||||
if (sel_cnt == 0) {
|
if (sel_cnt == 0) {
|
||||||
selection.clear();
|
selection.clear();
|
||||||
wxGetApp().plater()->canvas3D()->render();
|
wxGetApp().plater()->canvas3D()->set_as_dirty();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1391,7 +1391,7 @@ void ObjectList::update_selections_on_canvas()
|
||||||
else
|
else
|
||||||
add_to_selection(item, selection, true);
|
add_to_selection(item, selection, true);
|
||||||
|
|
||||||
wxGetApp().plater()->canvas3D()->render();
|
wxGetApp().plater()->canvas3D()->set_as_dirty();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1402,7 +1402,7 @@ void ObjectList::update_selections_on_canvas()
|
||||||
for (auto item: sels)
|
for (auto item: sels)
|
||||||
add_to_selection(item, selection, false);
|
add_to_selection(item, selection, false);
|
||||||
|
|
||||||
wxGetApp().plater()->canvas3D()->render();
|
wxGetApp().plater()->canvas3D()->set_as_dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectList::select_item(const wxDataViewItem& item)
|
void ObjectList::select_item(const wxDataViewItem& item)
|
||||||
|
|
Loading…
Reference in a new issue