From 0054134ff8e0a5ac5a54359910f7cb536c7492a0 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Wed, 25 Mar 2020 23:52:47 +0100 Subject: [PATCH] Fix of #3916 (macOS crash when generating WarningTexture) Likely the same cause as #3371, hopefully the same solution as presented in 4f1f507 --- src/slic3r/GUI/GLCanvas3D.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index c2713c80d..e422dc238 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -781,6 +781,13 @@ bool GLCanvas3D::WarningTexture::generate(const std::string& msg_utf8, const GLC #else // select default font const float scale = canvas.get_canvas_size().get_scale_factor(); +#if ENABLE_RETINA_GL + // For non-visible or non-created window getBackingScaleFactor function return 0.0 value. + // And using of the zero scale causes a crash, when we trying to draw text to the (0,0) rectangle + // https://github.com/prusa3d/PrusaSlicer/issues/3916 + if (scale <= 0.0f) + return false; +#endif wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Scale(scale); #endif