fix linux flatpak process app crash bug.

This commit is contained in:
alves
2026-03-05 17:37:33 +08:00
parent b27cd73e31
commit a3a3417c53
2 changed files with 19 additions and 0 deletions

View File

@@ -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())

View File

@@ -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)