mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-01 21:01:12 +00:00
Fix the CLI 3MF Export Crash After Rendering a Plate Thumbnail
Since the CLI can open an OpenGL context (#15745) it renders plate thumbnails on export, and the viewport restore at the end of render_thumbnail_internal (#15674) then reads the plater through the wx application. The CLI has neither, so every --export-3mf on a machine with a display died with a segmentation fault after the first thumbnail. Skip the restore when there is no application or no plater; the GUI path is unchanged.
This commit is contained in:
@@ -6546,8 +6546,11 @@ void GLCanvas3D::render_thumbnail_internal(ThumbnailData& thumbnail_data, const
|
|||||||
// glsafe(::glClearColor(1.0f, 1.0f, 1.0f, 1.0f));
|
// glsafe(::glClearColor(1.0f, 1.0f, 1.0f, 1.0f));
|
||||||
BOOST_LOG_TRIVIAL(info) << boost::format("render_thumbnail: finished");
|
BOOST_LOG_TRIVIAL(info) << boost::format("render_thumbnail: finished");
|
||||||
|
|
||||||
// Puts the canvas viewport back in place of the thumbnail one set above.
|
// Puts the canvas viewport back in place of the thumbnail one set above. The CLI renders
|
||||||
wxGetApp().plater()->get_camera().apply_viewport();
|
// thumbnails with no application and no plater, so there is no canvas viewport to restore.
|
||||||
|
if (wxTheApp != nullptr)
|
||||||
|
if (Plater *plater = wxGetApp().plater(); plater != nullptr)
|
||||||
|
plater->get_camera().apply_viewport();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas3D::render_thumbnail_framebuffer(ThumbnailData& thumbnail_data, unsigned int w, unsigned int h, const ThumbnailsParams& thumbnail_params,
|
void GLCanvas3D::render_thumbnail_framebuffer(ThumbnailData& thumbnail_data, unsigned int w, unsigned int h, const ThumbnailsParams& thumbnail_params,
|
||||||
|
|||||||
Reference in New Issue
Block a user