changeset 4609:630002c8be85

Fix cleanup functions.
author Sunny Sachanandani <sunnysachanandani@gmail.com>
date Wed, 21 Jul 2010 18:38:40 +0530
parents ff7b00d4b0d3
children 32991e17e2b6
files src/video/x11/SDL_x11render.c
diffstat 1 files changed, 26 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/x11/SDL_x11render.c	Wed Jul 21 18:33:13 2010 +0530
+++ b/src/video/x11/SDL_x11render.c	Wed Jul 21 18:38:40 2010 +0530
@@ -2041,6 +2041,13 @@
         data->pixels = NULL;
     }
 #endif
+#ifdef SDL_VIDEO_DRIVER_X11_XRENDER
+    if (renderdata->use_xrender) {
+        if (data->picture) {
+            XRenderFreePicture(renderdata->display, data->picture);
+        }
+    }
+#endif
     if (data->scaling_image) {
         SDL_free(data->scaling_image->data);
         data->scaling_image->data = NULL;
@@ -2065,7 +2072,7 @@
                 XFreePixmap(data->display, data->pixmaps[i]);
             }
 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
-            if (data->pixmap_picts[i] != None) {
+            if (data->use_xrender && data->pixmap_picts[i]) {
                 XRenderFreePicture(data->display, data->pixmap_picts[i]);
             }
 #endif
@@ -2074,17 +2081,24 @@
             XFreeGC(data->display, data->gc);
         }
 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
-        if (data->stencil_gc) {
-            XFreeGC(data->display, data->stencil_gc);
-        }
-        if (data->stencil) {
-            XFreePixmap(data->display, data->stencil);
-        }
-        if (data->drawable_pict) {
-            XRenderFreePicture(data->display, data->drawable_pict);
-        }
-        if (data->xwindow_pict) {
-            XRenderFreePicture(data->display, data->xwindow_pict);
+        if (data->use_xrender) {
+            if (data->stencil_gc) {
+                XFreeGC(data->display, data->stencil_gc);
+            }
+            if (data->stencil) {
+                XFreePixmap(data->display, data->stencil);
+            }
+            if (data->stencil_pict) {
+                XRenderFreePicture(data->display, data->stencil_pict);
+            }
+            if (data->xwindow_pict) {
+                XRenderFreePicture(data->display, data->xwindow_pict);
+            }
+#ifdef SDL_VIDEO_DRIVER_X11_XDAMAGE
+            if (data->use_xdamage && data->stencil_damage) {
+                XDamageDestroy(data->display, data->stencil_damage);
+            }
+#endif
         }
 #endif
         SDL_FreeDirtyRects(&data->dirty);