From a3a3417c53dd2d0c6ade184fb69a44e10ef2eace Mon Sep 17 00:00:00 2001 From: alves Date: Thu, 5 Mar 2026 17:37:33 +0800 Subject: [PATCH] fix linux flatpak process app crash bug. --- src/slic3r/GUI/MainFrame.cpp | 6 ++++++ src/slic3r/GUI/Widgets/DropDown.cpp | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index e0350ba246..2926d2dca5 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -270,6 +270,12 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_ // Load the icon either from the exe, or from the ico file. SetIcon(main_frame_icon(wxGetApp().get_app_mode())); +#ifdef __WXGTK__ + // GTK/X11: set minimum size before any layout so gtk_widget_set_size_request and + // gtk_window_resize never see 0 or negative dimensions (avoids assertion failures). + SetMinSize(wxGetApp().get_min_size()); +#endif + // initialize tabpanel and menubar init_tabpanel(); if (wxGetApp().is_gcode_viewer()) diff --git a/src/slic3r/GUI/Widgets/DropDown.cpp b/src/slic3r/GUI/Widgets/DropDown.cpp index ab48a27d2d..380d23bff4 100644 --- a/src/slic3r/GUI/Widgets/DropDown.cpp +++ b/src/slic3r/GUI/Widgets/DropDown.cpp @@ -365,6 +365,11 @@ void DropDown::messureSize() } szContent.y *= std::min((size_t)15, texts.size()); szContent.y += texts.size() > 15 ? rowSize.y / 2 : 0; +#ifdef __WXGTK__ + // GTK requires width >= -1 and height > 0 for gtk_window_resize/set_size_request + if (szContent.x < 1) szContent.x = 1; + if (szContent.y < 1) szContent.y = 1; +#endif wxWindow::SetSize(szContent); #ifdef __WXGTK__ // Gtk has a wrapper window for popup widget @@ -384,6 +389,10 @@ void DropDown::autoPosition() size = rowSize; size.y *= std::min((size_t)15, texts.size()); size.y += texts.size() > 15 ? rowSize.y / 2 : 0; +#ifdef __WXGTK__ + if (size.x < 1) size.x = 1; + if (size.y < 1) size.y = 1; +#endif if (size != GetSize()) { wxWindow::SetSize(size); offset = wxPoint(); @@ -396,6 +405,10 @@ void DropDown::autoPosition() if (GetPosition().y + size.y + 10 > drect.GetBottom()) { if (use_content_width && texts.size() <= 15) size.x += 6; size.y = drect.GetBottom() - GetPosition().y - 10; +#ifdef __WXGTK__ + if (size.y < 1) size.y = 1; + if (size.x < 1) size.x = 1; +#endif wxWindow::SetSize(size); if (selection >= 0) { if (offset.y + rowSize.y * (selection + 1) > size.y)