Package: wxglade
Version: 1.0.5+repack-2
Severity: grave
Tags: patch

Wxglade crashes with a segmentation fault on startup. See below for the
output. This is fixed upstream by this commit:

https://github.com/wxGlade/wxGlade/commit/05943a8374a24b862e76f03643a775c09582703f

I also attached this as a patch to this bug report.

Regards
Gaudenz

$ wxglade
INFO    : Starting wxGlade version "1.0.5+repack" on Python 3.11.9
INFO    : Using wxPython 4.2.1
INFO    : Loading "wconfig" modules from /usr/share/wxglade/widgets/widgets.txt:
INFO    : Load code generators:
INFO    :   C++ generator loaded
INFO    :   lisp generator loaded
INFO    :   XRC generator loaded
INFO    :   perl generator loaded
INFO    :   python generator loaded
INFO    : Loading widgets from /usr/share/wxglade/widgets/widgets.txt:
INFO    :       frame
INFO    :       dialog
INFO    :       panel
INFO    :       notebook
INFO    :       splitter_window
INFO    :       button
INFO    :       toggle_button
INFO    :       bitmap_button
INFO    :       spin_button
INFO    :       text_ctrl
INFO    :       choice
INFO    :       combo_box
INFO    :       list_box
INFO    :       check_list_box
INFO    :       checkbox
INFO    :       radio_button
INFO    :       radio_box
INFO    :       spin_ctrl
INFO    :       spin_ctrl_double
INFO    :       slider
INFO    :       gauge
22:45:39: Debug: Adding duplicate image handler for 'Windows bitmap file'
22:45:39: Debug: Adding duplicate animation handler for '1' type
22:45:39: Debug: Adding duplicate animation handler for '2' type
INFO    :       calendar_ctrl
INFO    :       generic_calendar_ctrl
INFO    :       datepicker_ctrl
INFO    :       list_ctrl
INFO    :       tree_ctrl
INFO    :       grid
INFO    :       static_text
INFO    :       hyperlink_ctrl
INFO    :       static_line
INFO    :       static_bitmap
INFO    :       spacer
INFO    :       property_grid_manager
INFO    :       search_ctrl
INFO    :       custom_widget
INFO    :       menubar
INFO    :       toolbar
INFO    :       statusbar
INFO    : Load sizer generators:
INFO    :   for C++
INFO    :   for lisp
INFO    :   for XRC
INFO    :   for perl
INFO    :   for python
Segmentation fault



-- System Information:
Debian Release: trixie/sid
  APT prefers testing
  APT policy: (500, 'testing'), (100, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.7.12-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=en_US.utf8, LC_CTYPE=de_CH.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages wxglade depends on:
ii  python3           3.11.8-1
ii  python3-wxgtk4.0  4.2.1+dfsg-3+b2

wxglade recommends no packages.

wxglade suggests no packages.

-- no debconf information
>From 05943a8374a24b862e76f03643a775c09582703f Mon Sep 17 00:00:00 2001
From: DietmarSchwertberger <git...@schwertberger.de>
Date: Sat, 11 May 2024 19:27:49 +0200
Subject: [PATCH] destroy dummy panel later, to work around issue #547

---
 main.py | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/main.py b/main.py
index a0a410c8..a68d8c9b 100644
--- a/main.py
+++ b/main.py
@@ -89,10 +89,11 @@ def __init__(self, parent):
         sizer.Add(self.notebook, 1, wx.EXPAND, 0)
 
         # for GTK3: add a panel to determine page size
-        p = wx.Panel(self.notebook)
+        self._dummy_page = p = wx.Panel(self.notebook)
         self.notebook.AddPage(p, "panel")
         self._notebook_decoration_size = None
         p.Bind(wx.EVT_SIZE, self.on_panel_size)
+        self._edit_triggered = False  # for MSW to avoid multiple calls to 
set_widget
 
         self.SetSizer(sizer)
         self.Layout()
@@ -153,8 +154,12 @@ def create_editor(self, edit_widget):
         self.notebook.Hide()
 
         # remember the notebook page to be selected
-        selection = self.notebook.GetSelection()
-        select_page = self.pagenames[selection]  if selection!=-1  else None
+        if self._dummy_page or not self.pagenames:
+            self._dummy_page = None
+            select_page = None
+        else:
+            selection = self.notebook.GetSelection()
+            select_page = self.pagenames[selection]  if selection!=-1  else 
None
 
         # clear notebook pages
         #self.notebook.DeleteAllPages()  # deletes also the windows on the 
pages
@@ -231,6 +236,7 @@ def end_page(self, panel, sizer, header, select=False):
     def _set_page_size(self, scrolled):
         # set ScrolledWindow and Panel to available size; enable scrolling, if 
required
         # gets available size for notebook pages
+        if not self.pagenames: return  # in initialization
         ws, hs = self.notebook.GetSize()
         ws -= self._notebook_decoration_size[0]
         hs -= self._notebook_decoration_size[1]
@@ -257,13 +263,16 @@ def on_notebook_size(self, event):
     def on_panel_size(self, event):
         # when the dummy panel receives a size event, we know that things are 
ready to calculate the notebook pages size
         # calculate decoration size from the dummy panel that was added 
initially
+        # this might be called several times during initialization
+        # on Windows the sizes change, it's fine to take the last value; 
actually the correct value is required for GTK
         if event.GetSize() != (0,0):
             dummy_panel = self.notebook.GetPage(0)
             wp, hp = dummy_panel.GetSize()    # page/panel size
             wn, hn = self.notebook.GetSize()  # notebook size
             self._notebook_decoration_size = (wn-wp, hn-hp)
-            self.notebook.RemovePage(0)
-            compat.DestroyLater(dummy_panel)
+            if wx.Platform == '__WXMSW__' and not self._edit_triggered:
+                # as the dummy is not deleted any more due to GTK, we need to 
display something
+                wx.CallLater(150, self.set_widget, common.root)
         else:
             # Mac OS: inital event on creation
             event.Skip()

Reply via email to