[cogl/wip/for-cairo-cogl: 7/12] framebuffer: associate tex with fb after Object init



commit bdfb15fdeae2e9005da993ff8c409b212a97abf6
Author: Robert Bragg <robert linux intel com>
Date:   Sun Sep 18 15:10:27 2011 +0100

    framebuffer: associate tex with fb after Object init
    
    This makes sure we don't associate an fb with a texture until the fb has
    been fully initialized since the association relies on setting user_data
    on the fb so we can have a callback when the fb is destroyed.
    
    Previously it was lucky that we were managing to associated user_data
    with fbs before they were fully initialized and after associating the fb
    with a texture we were then initializing the user_data state which meant
    we lost track of the original user_data and we weren't able to
    automatically disassociate fbs from textures when they were destroyed.
    
    FIXME: squash back - master does not have this bug

 cogl/cogl-framebuffer.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
index c8f2a42..3a0faca 100644
--- a/cogl/cogl-framebuffer.c
+++ b/cogl/cogl-framebuffer.c
@@ -697,6 +697,7 @@ _cogl_offscreen_new_to_texture_full (CoglHandle texhandle,
   int level_width;
   int level_height;
   int i;
+  CoglHandle ret;
 
   _COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE);
 
@@ -749,9 +750,11 @@ _cogl_offscreen_new_to_texture_full (CoglHandle texhandle,
                           level_width,
                           level_height);
 
+  ret = _cogl_offscreen_object_new (offscreen);
+
   _cogl_texture_associate_framebuffer (texhandle, fb);
 
-  return _cogl_offscreen_object_new (offscreen);
+  return ret;
 }
 
 CoglHandle



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]