diff options
author | Mike Engber <engber@src.gnome.org> | 2001-01-16 00:21:42 +0000 |
---|---|---|
committer | Mike Engber <engber@src.gnome.org> | 2001-01-16 00:21:42 +0000 |
commit | 134b259af2c5fdf644d38544a04ab7233da3598e (patch) | |
tree | 004bd084a0ce99bc83c12f1e44312759a802f4e4 /libnautilus-private | |
parent | f48a7e30781d7e1546039517d185c8a71a1df1f0 (diff) | |
download | nautilus-134b259af2c5fdf644d38544a04ab7233da3598e.tar.gz |
reviewed by: Gene Z. Ragan
reviewed by: Gene Z. Ragan
* libnautilus-extensions/nautilus-directory-background.c:
(set_root_pixmap): Fixed leaking x-server memory.
Diffstat (limited to 'libnautilus-private')
-rw-r--r-- | libnautilus-private/nautilus-directory-background.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/libnautilus-private/nautilus-directory-background.c b/libnautilus-private/nautilus-directory-background.c index de249dd4a..db0bb1986 100644 --- a/libnautilus-private/nautilus-directory-background.c +++ b/libnautilus-private/nautilus-directory-background.c @@ -511,32 +511,42 @@ dispose_root_pixmap (GdkPixmap *pixmap) * it at the same time. (This assumes that they follow the * same conventions we do * (copied from gnome-source/control-panels/capplets/background-properties/render-background.c) + * + * One diff between this and the capplet code is that the capplet tests nitems == 4 instead + * of nitems == 1, which means XKillClient is never called and the old pixmap is never freed. */ static void set_root_pixmap (GdkPixmap *pixmap) { - GdkAtom type; - gulong nitems, bytes_after; - gint format; + int result; + gint format; + gulong nitems; + gulong bytes_after; guchar *data_esetroot; - Pixmap pixmap_id = GDK_WINDOW_XWINDOW (pixmap); + Pixmap pixmap_id; + GdkAtom type; - XGrabServer (GDK_DISPLAY()); + data_esetroot = NULL; - XGetWindowProperty (GDK_DISPLAY(), GDK_ROOT_WINDOW(), - gdk_atom_intern("ESETROOT_PMAP_ID", FALSE), - 0L, 1L, False, XA_PIXMAP, - &type, &format, &nitems, &bytes_after, - &data_esetroot); + XGrabServer (GDK_DISPLAY()); - if (type == XA_PIXMAP) { - if (format == 32 && nitems == 4) - XKillClient(GDK_DISPLAY(), *((Pixmap*)data_esetroot)); + result = XGetWindowProperty (GDK_DISPLAY(), GDK_ROOT_WINDOW(), + gdk_atom_intern("ESETROOT_PMAP_ID", FALSE), + 0L, 1L, False, XA_PIXMAP, + &type, &format, &nitems, &bytes_after, + &data_esetroot); + if (result == Success && type == XA_PIXMAP && format == 32 && nitems == 1) { + XKillClient(GDK_DISPLAY(), *(Pixmap*)data_esetroot); + } + + if (data_esetroot != NULL) { XFree (data_esetroot); } ++set_root_pixmap_count; + + pixmap_id = GDK_WINDOW_XWINDOW (pixmap); XChangeProperty (GDK_DISPLAY(), GDK_ROOT_WINDOW(), gdk_atom_intern("ESETROOT_PMAP_ID", FALSE), XA_PIXMAP, |