From bef4655f7e577beb2c5c3cd1af86dd9e77ec2b08 Mon Sep 17 00:00:00 2001 From: "zhimin.zeng" Date: Mon, 20 May 2024 18:50:24 +0800 Subject: [PATCH] FIX: crash when generating text with thickness <= 0 github: 4122 Change-Id: I0fae6ea234ddb92ef2c2bec6e0f8f7555709ec4f --- src/libslic3r/Shape/TextShape.cpp | 3 +++ src/slic3r/GUI/Gizmos/GLGizmoText.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/Shape/TextShape.cpp b/src/libslic3r/Shape/TextShape.cpp index 5da654d85..d68ad577c 100644 --- a/src/libslic3r/Shape/TextShape.cpp +++ b/src/libslic3r/Shape/TextShape.cpp @@ -241,6 +241,9 @@ static void MakeMesh(TopoDS_Shape& theSolid, TriangleMesh& theMesh) void load_text_shape(const char*text, const char* font, const float text_height, const float thickness, bool is_bold, bool is_italic, TextResult &text_result) { + if (thickness <= 0) + return; + Handle(Font_FontMgr) aFontMgr = Font_FontMgr::GetInstance(); if (aFontMgr->GetAvailableFonts().IsEmpty()) aFontMgr->InitFontDataBase(); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoText.cpp b/src/slic3r/GUI/Gizmos/GLGizmoText.cpp index 744c740f0..17180990d 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoText.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoText.cpp @@ -328,7 +328,7 @@ bool GLGizmoText::gizmo_event(SLAGizmoEventType action, const Vec2d &mouse_posit return true; Plater *plater = wxGetApp().plater(); - if (!plater) + if (!plater || m_thickness <= 0) return true; ModelObject *model_object = selection.get_model()->objects[m_object_idx];