changeset 1078:069d4503ce54 trunk

[svn] - avoid BadDrawable error
author nenolod
date Fri, 19 May 2006 12:24:07 -0700
parents e3fbf8df3773
children d94ba9133f94
files audacious/playlist_list.c
diffstat 1 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/audacious/playlist_list.c	Fri May 19 12:09:49 2006 -0700
+++ b/audacious/playlist_list.c	Fri May 19 12:24:07 2006 -0700
@@ -120,29 +120,31 @@
 
 GdkPixmap *get_transparency_pixmap(void)
 {
-    Atom prop, type;
+    Atom type;
+    static Atom prop = None;
     int format;
     unsigned long length, after;
     unsigned char *data;
-    static GdkPixmap *retval = NULL;
+    GdkPixmap *retval = NULL;
 
-    if(retval)
-        return retval;
-
-    prop = XInternAtom(GDK_DISPLAY(), "_XROOTPMAP_ID", True);
-
+    if(prop == None)
+        prop = XInternAtom(GDK_DISPLAY(), "_XROOTPMAP_ID", True);
     if(prop == None)
         return NULL;
 
     XGetWindowProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(), prop, 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after, &data);
 
-    if(type == XA_PIXMAP)
-        retval = gdk_pixmap_foreign_new(*((Pixmap *)data));
+    if (data)
+    {
+        if(type == XA_PIXMAP)
+           retval = gdk_pixmap_foreign_new(*((Pixmap *)data));
+
+        XFree(data);
+    }
 
     return retval;
 }
 
-
 #else
 
 GdkPixmap *get_transparency_pixmap(void)