From ea471dc82de3ba540da1c16ad4cfddc8caf58f8c Mon Sep 17 00:00:00 2001 From: Chris Bennight Date: Sun, 27 Sep 2026 11:53:11 -0400 Subject: [PATCH] Fix model initialization without a wx application (#15866) Guard the smooth-normals preference read when CLI thumbnail generation initializes geometry without a wx application. Use the existing flat-normal path in that case and preserve GUI preferences. --- src/slic3r/GUI/GLModel.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/GLModel.cpp b/src/slic3r/GUI/GLModel.cpp index 3dd15c3fdd..92296030e1 100644 --- a/src/slic3r/GUI/GLModel.cpp +++ b/src/slic3r/GUI/GLModel.cpp @@ -456,8 +456,9 @@ void GLModel::init_from(const indexed_triangle_set& its) data.reserve_vertices(3 * its.indices.size()); data.reserve_indices(3 * its.indices.size()); - // Read user preference: smooth normals enabled - const bool smooth_normals_enabled = wxGetApp().app_config != nullptr && wxGetApp().app_config->get_bool(SETTING_OPENGL_PHONG_SMOOTH_NORMALS); + // CLI thumbnail generation can initialize models without a wx application. + const bool smooth_normals_enabled = wxApp::GetInstance() != nullptr && wxGetApp().app_config != nullptr && + wxGetApp().app_config->get_bool(SETTING_OPENGL_PHONG_SMOOTH_NORMALS); if (smooth_normals_enabled) { // Use per-corner smooth normals (via IGL)