Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#14752 closed defect (fixed)

Crash in wxWindowGTK::GTKHandleUnrealize() after opening wxChoice

Reported by: vadz Owned by: pcor
Priority: high Milestone: 2.9.5
Component: wxGTK Version: stable-latest
Keywords: Cc:
Blocked By: Blocking:
Patch: no

Description

Steps to reproduce:

  1. Run the widgets sample.
  2. Go to the wxChoice page.
  3. Click the button to insert a few items in wxChoice.
  4. Open wxChoice and close it.
  5. Click on the "Close" top level window button.

The sample crashes with

#0  wxWindow::GTKHandleUnrealize (this=0x7c6100) at /home/zeitlin/src/wx/HEAD/src/gtk/window.cpp:2055
#1  0x00007ffff73c56e7 in unrealize (win=0x7c6100) at /home/zeitlin/src/wx/HEAD/src/gtk/window.cpp:1978
#2  0x00007ffff569d47e in IA__g_closure_invoke (closure=0x7c99a0, return_value=0x0, n_param_values=1, param_values=0x96a2a0, invocation_hint=0x7fffffffcea0)
    at /scratch/build-area/glib2.0-2.24.2/gobject/gclosure.c:767
...
#21 0x00007ffff569f850 in IA__g_object_run_dispose (object=0x77a490) at /scratch/build-area/glib2.0-2.24.2/gobject/gobject.c:820
#22 0x00007ffff73c6aac in wxWindow::~wxWindow (this=0x798760, __in_chrg=<value optimized out>) at /home/zeitlin/src/wx/HEAD/src/gtk/window.cpp:2398
#23 0x00007ffff73b1604 in wxNonOwnedWindowBase::~wxNonOwnedWindowBase (this=0x798760, __in_chrg=<value optimized out>) at /home/zeitlin/src/wx/HEAD/include/wx/nonownedwnd.h:27
#24 0x00007ffff73b0b89 in wxNonOwnedWindow::~wxNonOwnedWindow (this=0x798760, __in_chrg=<value optimized out>) at /home/zeitlin/src/wx/HEAD/src/gtk/nonownedwnd.cpp:233
...

Debugging seems to show that it crashes when unrealizing the menu bar which is already destroyed by then. I have no idea why does this only happen after wxChoice had been opened though.

Paul, any ideas?

Change History (3)

comment:1 Changed 2 years ago by pcor

  • Owner set to pcor
  • Status changed from new to accepted
  • Summary changed from Crash in wxWindowGTK::GTKHandleRealized() after opening wxChoice to Crash in wxWindowGTK::GTKHandleUnrealize() after opening wxChoice

For reasons I did not investigate, the "unrealize" signal is coming in long after our wxMenuBar object is destroyed. By coincidence, I have been working on some changes related to this problem. But for now I will make a minimal change to fix this.

BTW, I was not able to reproduce this with my distro GTK2, which is gtk2-2.24.8-3.fc16.x86_64, but I did reproduce it with gtk+-2.24.8 sources that I built myself.

comment:2 Changed 2 years ago by PC

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [72691]) fix crash in wxWindowGTK::GTKHandleUnrealize(), closes #14752

comment:3 Changed 2 years ago by vadz

Thanks for the fix! I can confirm that it does fix the problem (which, for me, happens with standard Debian 2.20.1 GTK+). I still don't understand why does this happen only after showing wxChoice drop down and I wonder if this could be related to the (last) problem of #2628.

Note: See TracTickets for help on using tickets.