Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Jun 2026 13:02:54 +0000
From:      Kenneth Raplee <kenrap@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 172a41a97490 - main - cad/OrcaSlicer: Fix multiple wx assertion issues
Message-ID:  <6a368f7e.37001.39f0888d@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by kenrap:

URL: https://cgit.FreeBSD.org/ports/commit/?id=172a41a97490ce2eac7f2e19e9245012b1e21d8b

commit 172a41a97490ce2eac7f2e19e9245012b1e21d8b
Author:     Kenneth Raplee <kenrap@FreeBSD.org>
AuthorDate: 2026-06-18 03:14:04 +0000
Commit:     Kenneth Raplee <kenrap@FreeBSD.org>
CommitDate: 2026-06-20 13:02:37 +0000

    cad/OrcaSlicer: Fix multiple wx assertion issues
    
    PR:             294281
    Approved by:    makc (mentor)
    
    Since our x11-toolkits/wxgtk* builds are assert-enabled we have to fix
    the problems that upstream didn't address.
    
    In addition, reformat the Makefile to improve readability.
---
 cad/OrcaSlicer/Makefile                            | 19 ++++----
 .../files/patch-src_slic3r_GUI_BBLTopbar.cpp       | 17 +++++++
 .../files/patch-src_slic3r_GUI_Field.cpp           | 28 +++++++++--
 .../files/patch-src_slic3r_GUI_GUI__App.cpp        | 57 +++++++++++++++++-----
 .../files/patch-src_slic3r_GUI_MainFrame.cpp       | 18 +++++++
 .../files/patch-src_slic3r_GUI_MsgDialog.cpp       | 16 ++++++
 .../files/patch-src_slic3r_GUI_Plater.cpp          | 13 ++++-
 7 files changed, 141 insertions(+), 27 deletions(-)

diff --git a/cad/OrcaSlicer/Makefile b/cad/OrcaSlicer/Makefile
index 27cdfb1d7960..2dba453e6567 100644
--- a/cad/OrcaSlicer/Makefile
+++ b/cad/OrcaSlicer/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	OrcaSlicer
-DISTVERSIONPREFIX=v
+DISTVERSIONPREFIX=	v
 DISTVERSION=	2.3.2
+PORTREVISION=	1
 CATEGORIES=	cad
 
 MAINTAINER=	kenrap@FreeBSD.org
@@ -32,8 +33,8 @@ LIB_DEPENDS=	libboost_filesystem.so:devel/boost-libs \
 		libwebkit2gtk-4.1.so:www/webkit2-gtk@41 \
 		libwx_baseu-3.2.so:x11-toolkits/wxgtk32
 
-USES=	cmake desktop-file-utils gl gnome gstreamer jpeg \
-	localbase:ldflags pkgconfig ssl xorg
+USES=		cmake desktop-file-utils gl gnome gstreamer jpeg \
+		localbase:ldflags pkgconfig ssl xorg
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	OrcaSlicer
@@ -42,14 +43,12 @@ USE_GL=		gl glew
 USE_GNOME=	gtk30
 USE_XORG=	x11
 
-CMAKE_ARGS=	-DSLIC3R_FHS=1 \
-		-DSLIC3R_GTK=3 \
-		-DSLIC3R_STATIC=0 \
-		-DORCA_TOOLS=1 \
+CMAKE_ARGS=	-DBBL_INTERNAL_TESTING=0 \
 		-DBBL_RELEASE_TO_PUBLIC=1 \
-		-DBBL_INTERNAL_TESTING=0
-
-CXXFLAGS+=	-DwxDEBUG_LEVEL=0
+		-DORCA_TOOLS=1 \
+		-DSLIC3R_FHS=1 \
+		-DSLIC3R_GTK=3 \
+		-DSLIC3R_STATIC=0
 
 post-patch:
 	${CP} ${FILESDIR}/hid.c ${WRKSRC}/deps_src/hidapi/linux/hid.c
diff --git a/cad/OrcaSlicer/files/patch-src_slic3r_GUI_BBLTopbar.cpp b/cad/OrcaSlicer/files/patch-src_slic3r_GUI_BBLTopbar.cpp
new file mode 100644
index 000000000000..e1a7a5359f46
--- /dev/null
+++ b/cad/OrcaSlicer/files/patch-src_slic3r_GUI_BBLTopbar.cpp
@@ -0,0 +1,17 @@
+--- src/slic3r/GUI/BBLTopbar.cpp.orig	2026-03-22 17:56:38 UTC
++++ src/slic3r/GUI/BBLTopbar.cpp
+@@ -125,9 +125,12 @@
+     int bmpX = 0, bmpY = 0;
+     int textX = 0, textY = 0;
+ 
++    // Fetch the bitmap via the bundle with the real toolbar window. item.GetBitmap()/
++    // GetDisabledBitmap() use the item's own window (NULL for normal buttons), which trips wx's
++    // "window must be valid" assert in wxBitmapBundle::GetPreferredBitmapSizeFor().
+     const wxBitmap& bmp = item.GetState() & wxAUI_BUTTON_STATE_DISABLED
+-        ? item.GetDisabledBitmap()
+-        : item.GetBitmap();
++        ? item.GetDisabledBitmapBundle().GetBitmapFor(wnd)
++        : item.GetBitmapBundle().GetBitmapFor(wnd);
+ 
+     const wxSize bmpSize = bmp.IsOk() ? bmp.GetScaledSize() : wxSize(0, 0);
+ 
diff --git a/cad/OrcaSlicer/files/patch-src_slic3r_GUI_Field.cpp b/cad/OrcaSlicer/files/patch-src_slic3r_GUI_Field.cpp
index ffe3156d42a5..05216fb35cf6 100644
--- a/cad/OrcaSlicer/files/patch-src_slic3r_GUI_Field.cpp
+++ b/cad/OrcaSlicer/files/patch-src_slic3r_GUI_Field.cpp
@@ -1,6 +1,28 @@
 --- src/slic3r/GUI/Field.cpp.orig	2026-03-22 17:56:38 UTC
 +++ src/slic3r/GUI/Field.cpp
-@@ -2043,7 +2043,7 @@ void ColourPicker::on_button_click(wxCommandEvent &eve
+@@ -825,7 +825,11 @@ void TextCtrl::BUILD() {
+     auto temp = m_opt.multiline
+         ? (wxWindow*)builder1.build(m_parent, wxID_ANY, "", wxDefaultPosition, size, wxTE_MULTILINE)
+         : builder2.build(m_parent, "", "", "", wxDefaultPosition, size, wxTE_PROCESS_ENTER);
+-    temp->SetLabel(_L(m_opt.sidetext));
++    // For multiline fields temp is a raw wxTextCtrl, whose SetLabel() asserts
++    // in wx 3.2+ (and the side text is unused there since m_combine_side_text is
++    // false). Only set the label on the TextInput composite.
++    if (!m_opt.multiline)
++        temp->SetLabel(_L(m_opt.sidetext));
+ 	auto text_ctrl = m_opt.multiline ? (wxTextCtrl *)temp : ((TextInput *) temp)->GetTextCtrl();
+     text_ctrl->SetValue(text_value);
+     temp->SetSize(size);
+@@ -1190,7 +1194,7 @@ void SpinCtrl::BUILD() {
+ 		wxSP_ARROW_KEYS);
+     temp->SetSize(size);
+     temp->SetLabel(_L(m_opt.sidetext));
+-    temp->GetTextCtrl()->SetLabel(text_value);
++    temp->GetTextCtrl()->ChangeValue(text_value);
+     temp->SetRange(min_val, max_val);
+     temp->SetValue(default_value);
+     m_combine_side_text = true;
+@@ -2043,7 +2047,7 @@ void ColourPicker::on_button_click(wxCommandEvent &eve
  }
  
  void ColourPicker::on_button_click(wxCommandEvent &event) {
@@ -9,7 +31,7 @@
      if (m_clrData) {
          std::vector<std::string> colors = wxGetApp().app_config->get_custom_color_from_config();
          for (int i = 0; i < colors.size(); i++) {
-@@ -2056,7 +2056,7 @@ void ColourPicker::convert_to_picker_widget(wxColourPi
+@@ -2056,7 +2060,7 @@ void ColourPicker::convert_to_picker_widget(wxColourPi
  
  void ColourPicker::convert_to_picker_widget(wxColourPickerCtrl *widget)
  {
@@ -18,7 +40,7 @@
      m_picker_widget = dynamic_cast<wxColourPickerWidget*>(widget->GetPickerCtrl());
      if (m_picker_widget) {
          m_picker_widget->Bind(wxEVT_BUTTON, &ColourPicker::on_button_click, this);
-@@ -2066,7 +2066,7 @@ void ColourPicker::save_colors_to_config() {
+@@ -2066,7 +2070,7 @@ void ColourPicker::save_colors_to_config() {
  }
  
  void ColourPicker::save_colors_to_config() {
diff --git a/cad/OrcaSlicer/files/patch-src_slic3r_GUI_GUI__App.cpp b/cad/OrcaSlicer/files/patch-src_slic3r_GUI_GUI__App.cpp
index 60eb8cb85dc9..d619f0808d35 100644
--- a/cad/OrcaSlicer/files/patch-src_slic3r_GUI_GUI__App.cpp
+++ b/cad/OrcaSlicer/files/patch-src_slic3r_GUI_GUI__App.cpp
@@ -1,6 +1,14 @@
 --- src/slic3r/GUI/GUI_App.cpp.orig	2026-03-22 17:56:38 UTC
 +++ src/slic3r/GUI/GUI_App.cpp
-@@ -473,7 +473,7 @@ class SplashScreen : public wxSplashScreen (private)
+@@ -38,6 +38,7 @@
+ #include <wx/stdpaths.h>
+ #include <wx/imagpng.h>
+ #include <wx/display.h>
++#include <wx/sizer.h> // for wxSizerFlags::DisableConsistencyChecks()
+ #include <wx/menu.h>
+ #include <wx/menuitem.h>
+ #include <wx/filedlg.h>
+@@ -473,7 +474,7 @@ class SplashScreen : public wxSplashScreen (private)
      m_constant_text;
  };
  
@@ -9,7 +17,7 @@
  static void migrate_flatpak_legacy_datadir(const boost::filesystem::path &data_dir_path)
  {
      if(!boost::filesystem::exists("/.flatpak-info"))
-@@ -927,6 +927,7 @@ void GUI_App::post_init()
+@@ -927,6 +928,7 @@ void GUI_App::post_init()
          }
          else {
              BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << "Found glcontext not ready, postpone the init";
@@ -17,7 +25,7 @@
          }
  //#endif
          if (is_editor())
-@@ -2319,7 +2320,7 @@ bool GUI_App::init_opengl()
+@@ -2319,7 +2321,7 @@ bool GUI_App::init_opengl()
  
  bool GUI_App::init_opengl()
  {
@@ -26,7 +34,21 @@
      bool status = m_opengl_mgr.init_gl();
      m_opengl_initialized = true;
      return status;
-@@ -2761,7 +2762,7 @@ bool GUI_App::on_init_inner()
+@@ -2596,6 +2598,13 @@ bool GUI_App::OnInit()
+ 
+ bool GUI_App::OnInit()
+ {
++    // OrcaSlicer's UI passes wxSizer alignment flags that don't match the
++    // sizer orientation in many places. wxWidgets only ignores them, but
++    // our assert-enabled x11-toolkits/wxgtk* builds pop up a "DO NOT PANIC"
++    // dialog for each one. Disable the developer-only consistency checks so
++    // end users aren't spammed while the behavior is unchanged.
++    wxSizerFlags::DisableConsistencyChecks();
++
+     try {
+         return on_init_inner();
+     } catch (const std::exception& e) {
+@@ -2761,7 +2770,7 @@ bool GUI_App::on_init_inner()
      wxCHECK_MSG(wxDirExists(resources_dir), false,
          wxString::Format(_L("Resources path does not exist or is not a directory: %s"), resources_dir));
  
@@ -35,7 +57,7 @@
      if (! check_old_linux_datadir(GetAppName())) {
          std::cerr << "Quitting, user chose to move their data to new location." << std::endl;
          return false;
-@@ -2907,7 +2908,7 @@ bool GUI_App::on_init_inner()
+@@ -2907,7 +2916,7 @@ bool GUI_App::on_init_inner()
  
          BOOST_LOG_TRIVIAL(info) << "begin to show the splash screen...";
          //BBS use BBL splashScreen
@@ -44,7 +66,7 @@
          wxYield();
          scrn->SetText(_L("Loading configuration")+ dots);
      }
-@@ -3143,6 +3144,11 @@ bool GUI_App::on_init_inner()
+@@ -3143,6 +3152,11 @@ bool GUI_App::on_init_inner()
      mainframe->Show(true);
      BOOST_LOG_TRIVIAL(info) << "main frame firstly shown";
  
@@ -56,7 +78,7 @@
  //#if BBL_HAS_FIRST_PAGE
      //BBS: set tp3DEditor firstly
      /*plater_->canvas3D()->enable_render(false);
-@@ -5000,7 +5006,7 @@ void GUI_App::check_new_version(bool show_tips, int by
+@@ -5000,7 +5014,7 @@ void GUI_App::check_new_version(bool show_tips, int by
  #ifdef __APPLE__
      platform = "macos";
  #endif
@@ -65,7 +87,7 @@
      platform = "linux";
  #endif
      std::string query_params = (boost::format("?name=slicer&version=%1%&guide_version=%2%")
-@@ -5083,7 +5089,7 @@ std::string detect_updater_os()
+@@ -5083,7 +5097,7 @@ std::string detect_updater_os()
      return "win";
  #elif defined(__APPLE__)
      return "macos";
@@ -74,7 +96,16 @@
      return "linux";
  #else
      return "unknown";
-@@ -6151,7 +6157,7 @@ bool GUI_App::switch_language()
+@@ -5332,6 +5346,8 @@ void GUI_App::check_new_version_sf(bool show_tips, int
+ 
+ void GUI_App::check_new_version_sf(bool show_tips, int by_user)
+ {
++    if (!by_user) return; // skip automatic update checks; allow manual ones
++
+     AppConfig* app_config = wxGetApp().app_config;
+     bool       check_stable_only = app_config->get_bool("check_stable_update_only");
+     auto version_check_url = app_config->version_check_url();
+@@ -6151,7 +6167,7 @@ bool GUI_App::switch_language()
      }
  }
  
@@ -83,7 +114,7 @@
  static const wxLanguageInfo* linux_get_existing_locale_language(const wxLanguageInfo* language,
                                                                  const wxLanguageInfo* system_language)
  {
-@@ -6359,7 +6365,7 @@ bool GUI_App::load_language(wxString language, bool in
+@@ -6359,7 +6375,7 @@ bool GUI_App::load_language(wxString language, bool in
                                                          m_language_info_best->CanonicalName.ToUTF8().data();
                          app_config->set("language", m_language_info_best->CanonicalName.ToUTF8().data());
                      }
@@ -92,7 +123,7 @@
                      wxString lc_all;
                      if (wxGetEnv("LC_ALL", &lc_all) && !lc_all.IsEmpty()) {
                          // Best language returned by wxWidgets on Linux apparently does not respect LC_ALL.
-@@ -6417,7 +6423,7 @@ bool GUI_App::load_language(wxString language, bool in
+@@ -6417,7 +6433,7 @@ bool GUI_App::load_language(wxString language, bool in
  		BOOST_LOG_TRIVIAL(info) << "Using Czech dictionaries for Slovak language";
      }
  
@@ -101,7 +132,7 @@
      // If we can't find this locale , try to use different one for the language
      // instead of just reporting that it is impossible to switch.
      if (!wxLocale::IsAvailable(locale_language_info->Language) && m_language_info_system) {
-@@ -7599,7 +7605,7 @@ void GUI_App::show_desktop_integration_dialog()
+@@ -7599,7 +7615,7 @@ void GUI_App::show_desktop_integration_dialog()
  
  void GUI_App::show_desktop_integration_dialog()
  {
@@ -110,7 +141,7 @@
      //wxCHECK_MSG(mainframe != nullptr, false, "Internal error: Main frame not created / null");
      DesktopIntegrationDialog dialog(mainframe);
      dialog.ShowModal();
-@@ -7985,7 +7991,7 @@ void GUI_App::associate_url(std::wstring url_prefix)
+@@ -7985,7 +8001,7 @@ void GUI_App::associate_url(std::wstring url_prefix)
          key_full.Create(false);
      }
      key_full = key_string;
diff --git a/cad/OrcaSlicer/files/patch-src_slic3r_GUI_MainFrame.cpp b/cad/OrcaSlicer/files/patch-src_slic3r_GUI_MainFrame.cpp
new file mode 100644
index 000000000000..34d405f0b205
--- /dev/null
+++ b/cad/OrcaSlicer/files/patch-src_slic3r_GUI_MainFrame.cpp
@@ -0,0 +1,18 @@
+--- src/slic3r/GUI/MainFrame.cpp.orig	2026-03-22 17:56:38 UTC
++++ src/slic3r/GUI/MainFrame.cpp
+@@ -117,12 +117,13 @@ class ResizeEdgePanel : public wxPanel (public)
+     static constexpr int BORDER_PX = 5;
+ 
+     ResizeEdgePanel(MainFrame* frame, Edge edge)
+-        : wxPanel(frame, wxID_ANY, wxDefaultPosition, wxDefaultSize,
+-                  wxBORDER_NONE | wxTRANSPARENT_WINDOW)
++        : wxPanel()
+         , m_frame(frame)
+         , m_edge(edge)
+     {
+         SetBackgroundStyle(wxBG_STYLE_TRANSPARENT);
++        Create(frame, wxID_ANY, wxDefaultPosition, wxDefaultSize,
++               wxBORDER_NONE | wxTRANSPARENT_WINDOW);
+         Bind(wxEVT_MOTION,       &ResizeEdgePanel::OnCursorUpdate, this);
+         Bind(wxEVT_ENTER_WINDOW, &ResizeEdgePanel::OnCursorUpdate, this);
+         Bind(wxEVT_LEFT_DOWN,    &ResizeEdgePanel::OnLeftDown,     this);
diff --git a/cad/OrcaSlicer/files/patch-src_slic3r_GUI_MsgDialog.cpp b/cad/OrcaSlicer/files/patch-src_slic3r_GUI_MsgDialog.cpp
new file mode 100644
index 000000000000..a9d1412af5ed
--- /dev/null
+++ b/cad/OrcaSlicer/files/patch-src_slic3r_GUI_MsgDialog.cpp
@@ -0,0 +1,16 @@
+--- src/slic3r/GUI/MsgDialog.cpp.orig	2026-03-22 17:56:38 UTC
++++ src/slic3r/GUI/MsgDialog.cpp
+@@ -178,9 +178,11 @@
+     bd->button = btn;
+     //bd->type   = type;
+ 
+-    mb->id        = wxString::Format("%d", m_buttons.size());
++    // build the key via std::to_string, not Format("%d", ...): size_t is
++    // 64-bit on LP64 (FreeBSD) and mismatches %d, tripping wx's format type-safety assert.
++    mb->id        = wxString(std::to_string(m_buttons.size()));
+     mb->buttondata = bd;
+-    m_buttons[ wxString::Format("%d", m_buttons.size())] = mb;
++    m_buttons[ wxString(std::to_string(m_buttons.size()))] = mb;
+     return btn;
+ };
+ 
diff --git a/cad/OrcaSlicer/files/patch-src_slic3r_GUI_Plater.cpp b/cad/OrcaSlicer/files/patch-src_slic3r_GUI_Plater.cpp
index 617d7d5e1487..7bb63df7b2b7 100644
--- a/cad/OrcaSlicer/files/patch-src_slic3r_GUI_Plater.cpp
+++ b/cad/OrcaSlicer/files/patch-src_slic3r_GUI_Plater.cpp
@@ -1,6 +1,17 @@
 --- src/slic3r/GUI/Plater.cpp.orig	2026-03-22 17:56:38 UTC
 +++ src/slic3r/GUI/Plater.cpp
-@@ -8886,9 +8886,6 @@ void Plater::priv::set_current_panel(wxPanel* panel, b
+@@ -529,7 +529,9 @@
+         //if (isBBL) {
+             wxBoxSizer *hsizer = new wxBoxSizer(wxHORIZONTAL);
+             hsizer->Add(image_printer, 0, wxLEFT  | wxALIGN_LEFT  | wxALIGN_CENTER_VERTICAL, FromDIP(10));
+-            hsizer->Add(combo_printer, 1, wxEXPAND | wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, FromDIP(2));
++            // Drop wxALIGN_* here; wxEXPAND overrides alignment in a box sizer, and the
++            // combination trips wx's sizer-flags consistency check.
++            hsizer->Add(combo_printer, 1, wxEXPAND | wxALL, FromDIP(2));
+             hsizer->AddSpacer(FromDIP(2));
+             hsizer->Add(btn_edit_printer, 0, wxRIGHT | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(SidebarProps::IconSpacing()));
+             //hsizer->Add(btn_connect_printer, 0, wxRIGHT | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(SidebarProps::IconSpacing()));
+@@ -8886,9 +8888,6 @@
      if (!old_panel) {
          //BBS: only switch to the first panel when visible
          panel->Show();


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a368f7e.37001.39f0888d>