Fix of #3916 (macOS crash when generating WarningTexture)

Likely the same cause as #3371, hopefully the same solution as presented in 4f1f507
This commit is contained in:
Lukas Matena 2020-03-25 23:52:47 +01:00
parent b3cebdb672
commit 0054134ff8

View File

@ -781,6 +781,13 @@ bool GLCanvas3D::WarningTexture::generate(const std::string& msg_utf8, const GLC
#else #else
// select default font // select default font
const float scale = canvas.get_canvas_size().get_scale_factor(); 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); wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Scale(scale);
#endif #endif