Leak in win32 display surface

Zozó Teki <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <CAE+APxgY+J5JFdeGve0LJ8pEuRa=E3NToKfq0eoZp448hwYraA@mail.gmail.com>
Hi,

I noticed that a win32 surface does not destroy its fallback image.

Creating a win32 display surface, doing something that creates the fallback
and deleting the win32 surface will leak the fallback surface.

In the below patch (against 1.12.14) I do 2 things.

1. In _cairo_win32_display_surface_finish I add code to destroy the
fallback image.
2. In _cairo_win32_display_surface_flush I modify the code to destroy the
fallback image even if there was damage made to it (of course only after
flushing the damage).

Any comments?

Zoltan



--- C:/Users/ethzrt/Documents/msc-generator/cairo-win32-display-surface.c Sun
Feb 10 14:07:15 2013
+++
C:/Users/ethzrt/Documents/msc-generator/cairo/src/win32/cairo-win32-display-surface.c
Fri
Feb 15 14:25:42 2013
@@ -428,6 +428,12 @@
  DeleteObject (surface->bitmap);
  DeleteDC (surface->win32.dc);
     }
+
+    /* Zozo If we created a fallback image, destroy it */
+    if (surface->fallback) {
+ cairo_surface_finish (surface->fallback);
+ cairo_surface_destroy (surface->fallback);
+    }

     if (surface->initial_clip_rgn)
  DeleteObject (surface->initial_clip_rgn);
@@ -568,10 +574,10 @@
     }
  }
  _cairo_damage_destroy (damage);
-    } else {
+    }
+
  cairo_surface_destroy (surface->fallback);
  surface->fallback = NULL;
-    }

     return status;
 }

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.