[cogl] cogl-texture: Make the list of registered types global, not per-context



commit 567f049d20554bb8ea4e40fa5e72a9fd0bbd409e
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Feb 12 17:55:45 2013 -0500

    cogl-texture: Make the list of registered types global, not per-context
    
    If we make this per-context and create two Cogl contexts, some types
    won't re-register, and we'll be in a broken state where some types will
    be considered not to be texture types.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=693696
    
    Reviewed-by: Neil Roberts <neil linux intel com>

 cogl/cogl-context-private.h |    4 ----
 cogl/cogl-context.c         |    4 ----
 cogl/cogl-texture.c         |   10 ++++------
 3 files changed, 4 insertions(+), 14 deletions(-)
---
diff --git a/cogl/cogl-context-private.h b/cogl/cogl-context-private.h
index fc528e7..5d7aacd 100644
--- a/cogl/cogl-context-private.h
+++ b/cogl/cogl-context-private.h
@@ -214,10 +214,6 @@ struct _CoglContext
   CoglBool current_gl_dither_enabled;
   CoglColorMask current_gl_color_mask;
 
-  /* List of types that will be considered a subclass of CoglTexture in
-     cogl_is_texture */
-  GSList           *texture_types;
-
   /* Clipping */
   /* TRUE if we have a valid clipping stack flushed. In that case
      current_clip_stack will describe what the current state is. If
diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c
index 11779f9..003940a 100644
--- a/cogl/cogl-context.c
+++ b/cogl/cogl-context.c
@@ -167,8 +167,6 @@ cogl_context_new (CoglDisplay *display,
   memset (context->features, 0, sizeof (context->features));
   context->private_feature_flags = 0;
 
-  context->texture_types = NULL;
-
   context->rectangle_state = COGL_WINSYS_RECTANGLE_STATE_UNKNOWN;
 
   memset (context->winsys_features, 0, sizeof (context->winsys_features));
@@ -492,8 +490,6 @@ _cogl_context_free (CoglContext *context)
   _cogl_bitmask_destroy (&context->enable_custom_attributes_tmp);
   _cogl_bitmask_destroy (&context->changed_bits_tmp);
 
-  g_slist_free (context->texture_types);
-
   if (context->current_modelview_entry)
     cogl_matrix_entry_unref (context->current_modelview_entry);
   if (context->current_projection_entry)
diff --git a/cogl/cogl-texture.c b/cogl/cogl-texture.c
index 4c8e718..2c7dc5e 100644
--- a/cogl/cogl-texture.c
+++ b/cogl/cogl-texture.c
@@ -76,12 +76,12 @@ cogl_texture_error_domain (void)
  * abstract class manually.
  */
 
+static GSList *_cogl_texture_types;
+
 void
 _cogl_texture_register_texture_type (const CoglObjectClass *klass)
 {
-  _COGL_GET_CONTEXT (ctxt, NO_RETVAL);
-
-  ctxt->texture_types = g_slist_prepend (ctxt->texture_types, (void *) klass);
+  _cogl_texture_types = g_slist_prepend (_cogl_texture_types, (void *) klass);
 }
 
 CoglBool
@@ -90,12 +90,10 @@ cogl_is_texture (void *object)
   CoglObject *obj = (CoglObject *)object;
   GSList *l;
 
-  _COGL_GET_CONTEXT (ctxt, FALSE);
-
   if (object == NULL)
     return FALSE;
 
-  for (l = ctxt->texture_types; l; l = l->next)
+  for (l = _cogl_texture_types; l; l = l->next)
     if (l->data == obj->klass)
       return TRUE;
 


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