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



commit 66c75f9a9d717dea6c0e1a4c7b41db6c5f017dc6
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>
    
    (cherry picked from commit 567f049d20554bb8ea4e40fa5e72a9fd0bbd409e)

 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 d82e809..31033d0 100644
--- a/cogl/cogl-context-private.h
+++ b/cogl/cogl-context-private.h
@@ -243,10 +243,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 4346ce3..175e69d 100644
--- a/cogl/cogl-context.c
+++ b/cogl/cogl-context.c
@@ -179,8 +179,6 @@ cogl_context_new (CoglDisplay *display,
   context->feature_flags = 0;
   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));
@@ -558,8 +556,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 eeadd5f..fbc1b01 100644
--- a/cogl/cogl-texture.c
+++ b/cogl/cogl-texture.c
@@ -78,12 +78,12 @@ cogl_texture_error_quark (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
@@ -92,12 +92,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]