mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-28 19:31:22 +00:00
fix: Linux Flatpak crash rendering plate thumbnails while slicing or saving (#15873)
This commit is contained in:
@@ -2354,6 +2354,13 @@ void GLCanvas3D::render_thumbnail(ThumbnailData & thumbnail_data,
|
|||||||
render_thumbnail(thumbnail_data, w, h, thumbnail_params, model_objects, m_volumes, camera_type, camera_view_angle_type, for_picking, ban_light);
|
render_thumbnail(thumbnail_data, w, h, thumbnail_params, model_objects, m_volumes, camera_type, camera_view_angle_type, for_picking, ban_light);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GLCanvas3D::_set_shown_canvas_current()
|
||||||
|
{
|
||||||
|
// Thumbnails also render outside render(), where another library's GL context (e.g. WebKitGTK's) can be current.
|
||||||
|
// Inside render(), the shown canvas is the one already bound.
|
||||||
|
return wxGetApp().plater()->get_current_canvas3D()->_set_current();
|
||||||
|
}
|
||||||
|
|
||||||
void GLCanvas3D::render_thumbnail(ThumbnailData & thumbnail_data,
|
void GLCanvas3D::render_thumbnail(ThumbnailData & thumbnail_data,
|
||||||
unsigned int w,
|
unsigned int w,
|
||||||
unsigned int h,
|
unsigned int h,
|
||||||
@@ -2365,6 +2372,9 @@ void GLCanvas3D::render_thumbnail(ThumbnailData & thumbnail_data,
|
|||||||
bool for_picking,
|
bool for_picking,
|
||||||
bool ban_light)
|
bool ban_light)
|
||||||
{
|
{
|
||||||
|
if (!_set_shown_canvas_current())
|
||||||
|
return;
|
||||||
|
|
||||||
GLShaderProgram* shader = nullptr;
|
GLShaderProgram* shader = nullptr;
|
||||||
if (for_picking)
|
if (for_picking)
|
||||||
shader = wxGetApp().get_shader("flat");
|
shader = wxGetApp().get_shader("flat");
|
||||||
@@ -2403,6 +2413,9 @@ void GLCanvas3D::render_thumbnail(ThumbnailData & thumbnail_d
|
|||||||
bool for_picking,
|
bool for_picking,
|
||||||
bool ban_light)
|
bool ban_light)
|
||||||
{
|
{
|
||||||
|
if (!_set_shown_canvas_current())
|
||||||
|
return;
|
||||||
|
|
||||||
GLShaderProgram *shader = wxGetApp().get_shader("thumbnail");
|
GLShaderProgram *shader = wxGetApp().get_shader("thumbnail");
|
||||||
switch (OpenGLManager::get_framebuffers_type()) {
|
switch (OpenGLManager::get_framebuffers_type()) {
|
||||||
case OpenGLManager::EFramebufferType::Arb: {
|
case OpenGLManager::EFramebufferType::Arb: {
|
||||||
|
|||||||
@@ -1320,6 +1320,7 @@ private:
|
|||||||
bool _init_collapse_toolbar();
|
bool _init_collapse_toolbar();
|
||||||
|
|
||||||
bool _set_current();
|
bool _set_current();
|
||||||
|
bool _set_shown_canvas_current();
|
||||||
void _resize(unsigned int w, unsigned int h);
|
void _resize(unsigned int w, unsigned int h);
|
||||||
|
|
||||||
//BBS: add part plate related logic
|
//BBS: add part plate related logic
|
||||||
|
|||||||
Reference in New Issue
Block a user