diff options
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/linux-fb/gdkcolor-fb.c | 1 | ||||
-rw-r--r-- | gdk/linux-fb/gdkscreen-fb.c | 12 | ||||
-rw-r--r-- | gdk/win32/gdkcolor-win32.c | 1 | ||||
-rw-r--r-- | gdk/win32/gdkscreen-win32.c | 12 | ||||
-rw-r--r-- | gdk/x11/gdkcolor-x11.c | 1 | ||||
-rw-r--r-- | gdk/x11/gdkscreen-x11.c | 12 | ||||
-rw-r--r-- | gdk/x11/gdkwindow-x11.c | 6 |
7 files changed, 40 insertions, 5 deletions
diff --git a/gdk/linux-fb/gdkcolor-fb.c b/gdk/linux-fb/gdkcolor-fb.c index 0435bbe48..179d1b750 100644 --- a/gdk/linux-fb/gdkcolor-fb.c +++ b/gdk/linux-fb/gdkcolor-fb.c @@ -52,6 +52,7 @@ gdk_colormap_finalize (GObject *object) g_free (private->info); g_free (colormap->colors); + g_free (private); G_OBJECT_CLASS (parent_class)->finalize (object); } diff --git a/gdk/linux-fb/gdkscreen-fb.c b/gdk/linux-fb/gdkscreen-fb.c index ece7cf234..cf3563c63 100644 --- a/gdk/linux-fb/gdkscreen-fb.c +++ b/gdk/linux-fb/gdkscreen-fb.c @@ -51,7 +51,17 @@ void gdk_screen_set_default_colormap (GdkScreen *screen, GdkColormap *colormap) { - default_colormap = colormap; + GdkColormap *old_colormap; + + g_return_if_fail (GDK_IS_SCREEN (screen)); + g_return_if_fail (GDK_IS_COLORMAP (colormap)); + + old_colormap = default_colormap; + + default_colormap = g_object_ref (colormap); + + if (old_colormap) + g_object_unref (old_colormap); } int diff --git a/gdk/win32/gdkcolor-win32.c b/gdk/win32/gdkcolor-win32.c index 9db468770..94ee7edc6 100644 --- a/gdk/win32/gdkcolor-win32.c +++ b/gdk/win32/gdkcolor-win32.c @@ -114,6 +114,7 @@ gdk_colormap_finalize (GObject *object) g_free (private->info); g_free (colormap->colors); + g_free (private); G_OBJECT_CLASS (parent_class)->finalize (object); } diff --git a/gdk/win32/gdkscreen-win32.c b/gdk/win32/gdkscreen-win32.c index 96789e658..51850b27e 100644 --- a/gdk/win32/gdkscreen-win32.c +++ b/gdk/win32/gdkscreen-win32.c @@ -44,7 +44,17 @@ void gdk_screen_set_default_colormap (GdkScreen *screen, GdkColormap *colormap) { - default_colormap = colormap; + GdkColormap *old_colormap; + + g_return_if_fail (GDK_IS_SCREEN (screen)); + g_return_if_fail (GDK_IS_COLORMAP (colormap)); + + old_colormap = default_colormap; + + default_colormap = g_object_ref (colormap); + + if (old_colormap) + g_object_unref (old_colormap); } gint diff --git a/gdk/x11/gdkcolor-x11.c b/gdk/x11/gdkcolor-x11.c index 57f78b44c..415709930 100644 --- a/gdk/x11/gdkcolor-x11.c +++ b/gdk/x11/gdkcolor-x11.c @@ -143,6 +143,7 @@ gdk_colormap_finalize (GObject *object) g_free (private->info); g_free (colormap->colors); + g_free (private); G_OBJECT_CLASS (parent_class)->finalize (object); } diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c index dd030103f..c8f819727 100644 --- a/gdk/x11/gdkscreen-x11.c +++ b/gdk/x11/gdkscreen-x11.c @@ -244,10 +244,17 @@ void gdk_screen_set_default_colormap (GdkScreen *screen, GdkColormap *colormap) { + GdkColormap *old_colormap; + g_return_if_fail (GDK_IS_SCREEN (screen)); g_return_if_fail (GDK_IS_COLORMAP (colormap)); + + old_colormap = GDK_SCREEN_X11 (screen)->default_colormap; + + GDK_SCREEN_X11 (screen)->default_colormap = g_object_ref (colormap); - GDK_SCREEN_X11 (screen)->default_colormap = colormap; + if (old_colormap) + g_object_unref (old_colormap); } static void @@ -256,6 +263,9 @@ gdk_screen_x11_dispose (GObject *object) GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (object); _gdk_x11_events_uninit_screen (GDK_SCREEN (object)); + + g_object_unref (screen_x11->default_colormap); + screen_x11->default_colormap = NULL; screen_x11->root_window = NULL; diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index c440710a4..3904619f9 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -228,7 +228,7 @@ gdk_window_impl_x11_set_colormap (GdkDrawable *drawable, impl = GDK_WINDOW_IMPL_X11 (drawable); draw_impl = GDK_DRAWABLE_IMPL_X11 (drawable); - if (GDK_WINDOW_DESTROYED (draw_impl->wrapper)) + if (cmap && GDK_WINDOW_DESTROYED (draw_impl->wrapper)) return; /* chain up */ @@ -294,7 +294,8 @@ _gdk_windowing_window_init (GdkScreen * screen) g_assert (screen_x11->root_window == NULL); - screen_x11->default_colormap = gdk_screen_get_system_colormap (screen); + gdk_screen_set_default_colormap (screen, + gdk_screen_get_system_colormap (screen)); XGetGeometry (screen_x11->xdisplay, screen_x11->xroot_window, &screen_x11->xroot_window, &x, &y, &width, &height, &border_width, &depth); @@ -309,6 +310,7 @@ _gdk_windowing_window_init (GdkScreen * screen) draw_impl->xid = screen_x11->xroot_window; draw_impl->wrapper = GDK_DRAWABLE (private); draw_impl->colormap = gdk_screen_get_system_colormap (screen); + g_object_ref (draw_impl->colormap); private->window_type = GDK_WINDOW_ROOT; private->depth = depth; |