<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:psychon@znc.in" title="Uli Schlachter <psychon@znc.in>"> <span class="fn">Uli Schlachter</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - regression in cairo_surface_t refcounting when using cairo_surface_unmap_image"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=56981">bug 56981</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>FIXED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Blocks</td>
           <td>
                
           </td>
           <td>68382
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - regression in cairo_surface_t refcounting when using cairo_surface_unmap_image"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=56981#c4">Comment # 4</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - regression in cairo_surface_t refcounting when using cairo_surface_unmap_image"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=56981">bug 56981</a>
              from <span class="vcard"><a class="email" href="mailto:psychon@znc.in" title="Uli Schlachter <psychon@znc.in>"> <span class="fn">Uli Schlachter</span></a>
</span></b>
        <pre>This was fixed one and a half year ago with my second proposal ("Add that call
in _cairo_image_surface_clone_subimage()"):

commit 22b7fae0368ba6cff23b2ebdf58bd7d1bfdfbd6f
Author: Chris Wilson <<a href="mailto:chris@chris-wilson.co.uk">chris@chris-wilson.co.uk</a>>
Date:   Thu Jan 31 14:19:53 2013 +0000

    image: Add a reference for the clone's parent image

    We use the parent as a flag during map-to-image/umap-image that the
    resultant image came from a fallback rather than as direct call
    to the backend's map_to_image(). Whilst we use it as a simple flag,
    we need to make sure the parent surface obeys the reference counting
    semantics and is consistent for all callers.

    Unlike other users of the parent pointer, there is no resource sharing
    between the two surfaces.

    Reported-by: Henry Song <<a href="mailto:henry.song@samsung.com">henry.song@samsung.com</a>>
    Signed-off-by: Chris Wilson <<a href="mailto:chris@chris-wilson.co.uk">chris@chris-wilson.co.uk</a>>

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 3fe6e43..20a1c03 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -1240,7 +1240,14 @@ _cairo_image_surface_clone_subimage (cairo_surface_t    
        *surface,
     if (unlikely (status))
        goto error;

-    _cairo_image_surface_set_parent (to_image_surface (image), surface);
+    /* We use the parent as a flag during map-to-image/umap-image that the
+     * resultant image came from a fallback rather than as direct call
+     * to the backend's map_to_image(). Whilst we use it as a simple flag,
+     * we need to make sure the parent surface obeys the reference counting
+     * semantics and is consistent for all callers.
+     */
+    _cairo_image_surface_set_parent (to_image_surface (image),
+                                    cairo_surface_reference (surface));

     return to_image_surface (image);</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>