<div dir="ltr">Hi,<div><br></div><div style>I noticed that a win32 surface does not destroy its fallback image.</div><div style><br></div><div style>Creating a win32 display surface, doing something that creates the fallback and deleting the win32 surface will leak the fallback surface.</div>
<div style><br></div><div style>In the below patch (against 1.12.14) I do 2 things. </div><div style><br></div><div style>1. In _cairo_win32_display_surface_finish I add code to destroy the fallback image.</div><div style>
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).</div><div style><br></div><div style>Any comments?</div>
<div style><br></div><div style>Zoltan</div><div style><br></div><div style><br></div><div style><br></div><div style><div>--- C:/Users/ethzrt/Documents/msc-generator/cairo-win32-display-surface.c<span class="" style="white-space:pre">   </span>Sun Feb 10 14:07:15 2013</div>
<div>+++ C:/Users/ethzrt/Documents/msc-generator/cairo/src/win32/cairo-win32-display-surface.c<span class="" style="white-space:pre">   </span>Fri Feb 15 14:25:42 2013</div><div>@@ -428,6 +428,12 @@</div><div> <span class="" style="white-space:pre">      </span>DeleteObject (surface->bitmap);</div>
<div> <span class="" style="white-space:pre">  </span>DeleteDC (surface->win32.dc);</div><div>     }</div><div>+    </div><div>+    /* Zozo If we created a fallback image, destroy it */</div><div>+    if (surface->fallback) {</div>
<div>+<span class="" style="white-space:pre">   </span>cairo_surface_finish (surface->fallback);</div><div>+<span class="" style="white-space:pre">      </span>cairo_surface_destroy (surface->fallback);</div><div>+    }</div>
<div> </div><div>     if (surface->initial_clip_rgn)</div><div> <span class="" style="white-space:pre"> </span>DeleteObject (surface->initial_clip_rgn);</div><div>@@ -568,10 +574,10 @@</div><div> <span class="" style="white-space:pre"> </span>    }</div>
<div> <span class="" style="white-space:pre">  </span>}</div><div> <span class="" style="white-space:pre">        </span>_cairo_damage_destroy (damage);</div><div>-    } else {</div><div>+    } </div><div>+</div><div> <span class="" style="white-space:pre">   </span>cairo_surface_destroy (surface->fallback);</div>
<div> <span class="" style="white-space:pre">  </span>surface->fallback = NULL;</div><div>-    }</div><div> </div><div>     return status;</div><div> }</div><div><br></div></div></div>