FIX: Prevent crash when rendering color button on linux

jira: none

Change-Id: I8758c3a352bd206ff81ce72ed0ad902f8a79c30e
(cherry picked from commit 45818c4e762b540feb0a67d117b595eb589e8058)
This commit is contained in:
fei2.fang
2025-07-31 15:57:04 +08:00
committed by Noisyfox
parent cd0eb95c25
commit 51151a89c5

View File

@@ -686,10 +686,13 @@ wxBitmap *get_extruder_color_icon(std::string color, std::string label, int icon
#ifdef __WXOSX__
bitmap->UseAlpha();
wxMemoryDC dc(*bitmap);
#else
#elif defined(__WXMSW__)
wxClientDC cdc((wxWindow *) Slic3r::GUI::wxGetApp().mainframe);
wxMemoryDC dc(&cdc);
dc.SelectObject(*bitmap);
#else
wxMemoryDC dc;
dc.SelectObject(*bitmap);
#endif
dc.SetFont(::Label::Body_12);
Slic3r::GUI::WxFontUtils::get_suitable_font_size(icon_height - 2, dc);