GNOME Bugzilla – Bug 581110
Handlebox widget uses static variables, crashes in multidisplay usage.
Last modified: 2011-10-01 07:27:40 UTC
Steps to reproduce: 1. Create a top level window with a detachable toolbar (i.e. a handlebox). 2. Detach the toolbar. 3. Close the display the window is on. 4. Create an indentical window as in 1), but on another display. 5. Detach the toolbar => crash in handlebox. Stack trace: This is a stack trace from Emacs which has the capability to do the steps above. The problem comes from gtkhandlebox.c which uses static variables and thus assumes there is only one display. gtkhandlebox.c contains: static GtkWidget * gtk_handle_box_get_invisible (void) { static GtkWidget *handle_box_invisible = NULL; if (!handle_box_invisible) { handle_box_invisible = gtk_invisible_new (); gtk_widget_show (handle_box_invisible); } return handle_box_invisible; } The handle_box_invisible points to the GtkWidget created on the first display, but it gets used even after that display is closed. Stack trace from emacs and gtk 2.16.1:
+ Trace 215031
Other information:
Should be fixed now.
This is not fixed right. When the first display is closed, all display-related variables becomes invalid. For example, GC:s. So when gtk_invisible_set_screen (as introduced by this fix) is called the second time, it crashes, because it tries to free resources from the first display. Note that first and second disply can be the same display, it just takes a close and reopen of the display to trigger this bug. The static variable really must be a per-display resource that is freed when the display is closed. Here is a new backtrace from Gtk+ 2.16.2:
+ Trace 216795
Created attachment 139930 [details] Program showing the bug. To reproduce the bug, compile the program and run it. Then 1. Detatch the tool bar. 2. Press the "Close/Reopen" button. 3. Detach the tool bar again => crash.
the handlebox widget has been deprecated in gtk 3.1.