[cogl/wip/cogl-1.14: 87/177] atlas: catch _create_texture errors



commit 63e0c1eac62a30729cf86c2c4b558b24764f3995
Author: Robert Bragg <robert linux intel com>
Date:   Thu Nov 8 19:20:45 2012 +0000

    atlas: catch _create_texture errors
    
    Previously we were passing NULL to
    cogl_texture_2d_new_{from_bitmap,with_size} so if there was an error the
    application would be aborted. This ensures we pass an internal CoglError
    so errors can be caught and suppressed instead.
    
    Reviewed-by: Neil Roberts <neil linux intel com>
    
    (cherry picked from commit b8d1a1db482e1417979df9f88f92da47aa954bd0)

 cogl/cogl-atlas.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/cogl/cogl-atlas.c b/cogl/cogl-atlas.c
index 2fe85f0..855fb50 100644
--- a/cogl/cogl-atlas.c
+++ b/cogl/cogl-atlas.c
@@ -279,6 +279,7 @@ _cogl_atlas_create_texture (CoglAtlas *atlas,
                             int height)
 {
   CoglTexture2D *tex;
+  CoglError *ignore_error = NULL;
 
   _COGL_GET_CONTEXT (ctx, NULL);
 
@@ -299,7 +300,7 @@ _cogl_atlas_create_texture (CoglAtlas *atlas,
 
       tex = cogl_texture_2d_new_from_bitmap (clear_bmp,
                                              atlas->texture_format,
-                                             NULL);
+                                             &ignore_error);
       cogl_object_unref (clear_bmp);
 
       g_free (clear_data);
@@ -309,9 +310,12 @@ _cogl_atlas_create_texture (CoglAtlas *atlas,
       tex = cogl_texture_2d_new_with_size (ctx,
                                            width, height,
                                            atlas->texture_format,
-                                           NULL);
+                                           &ignore_error);
     }
 
+  if (!tex)
+    cogl_error_free (ignore_error);
+
   return tex;
 }
 



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