comparison src/gtkutil.c @ 72778:ab6be05ddfb1

* gtkutil.c (xg_display_close): Always change default display if needed, check for < Gtk+ version 2.10 before calling gdk_display_close.
author Jan Djärv <jan.h.d@swipnet.se>
date Sun, 10 Sep 2006 12:17:19 +0000
parents 9db8c9a68f0f
children 790e14d9baae a1a25ac6c88a
comparison
equal deleted inserted replaced
72777:049cdc4ea1a1 72778:ab6be05ddfb1
129 xg_display_close (Display *dpy) 129 xg_display_close (Display *dpy)
130 { 130 {
131 #ifdef HAVE_GTK_MULTIDISPLAY 131 #ifdef HAVE_GTK_MULTIDISPLAY
132 GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (dpy); 132 GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (dpy);
133 133
134 /* GTK 2.2 has a bug that makes gdk_display_close crash (bug
135 http://bugzilla.gnome.org/show_bug.cgi?id=85715). This way
136 we can continue running, but there will be memory leaks. */
137
138 #if GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION < 4
139
140 /* If this is the default display, we must change it before calling 134 /* If this is the default display, we must change it before calling
141 dispose, otherwise it will crash. */ 135 dispose, otherwise it will crash on some Gtk+ versions. */
142 if (gdk_display_get_default () == gdpy) 136 if (gdk_display_get_default () == gdpy)
143 { 137 {
144 struct x_display_info *dpyinfo; 138 struct x_display_info *dpyinfo;
145 Display *new_dpy = 0; 139 Display *new_dpy = 0;
146 GdkDisplay *gdpy_new; 140 GdkDisplay *gdpy_new;
158 gdpy_new = gdk_x11_lookup_xdisplay (new_dpy); 152 gdpy_new = gdk_x11_lookup_xdisplay (new_dpy);
159 gdk_display_manager_set_default_display (gdk_display_manager_get (), 153 gdk_display_manager_set_default_display (gdk_display_manager_get (),
160 gdpy_new); 154 gdpy_new);
161 } 155 }
162 156
157 /* GTK 2.2-2.8 has a bug that makes gdk_display_close crash (bug
158 http://bugzilla.gnome.org/show_bug.cgi?id=85715). This way
159 we can continue running, but there will be memory leaks. */
160
161 #if GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION < 10
163 g_object_run_dispose (G_OBJECT (gdpy)); 162 g_object_run_dispose (G_OBJECT (gdpy));
164
165 #else 163 #else
166 /* I hope this will be fixed in GTK 2.4. It is what bug 85715 says. */ 164 /* This seems to be fixed in GTK 2.10. */
167 gdk_display_close (gdpy); 165 gdk_display_close (gdpy);
168 #endif 166 #endif
169 #endif /* HAVE_GTK_MULTIDISPLAY */ 167 #endif /* HAVE_GTK_MULTIDISPLAY */
170 } 168 }
171 169