gobject-introspection r905 - in trunk: . girepository



Author: otaylor
Date: Wed Nov 12 17:17:08 2008
New Revision: 905
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=905&view=rev

Log:
Fix management of ParseContext.includes_modules (#560419)

Fix some trivial bugs in managing the list of include modules.
(Add to module's list twice, not initialized to NULL, not freed.)

Modified:
   trunk/ChangeLog
   trunk/girepository/girparser.c

Modified: trunk/girepository/girparser.c
==============================================================================
--- trunk/girepository/girparser.c	(original)
+++ trunk/girepository/girparser.c	Wed Nov 12 17:17:08 2008
@@ -2479,9 +2479,11 @@
 	      for (l = ctx->include_modules; l; l = l->next)
 		g_ir_module_add_include_module (ctx->current_module, l->data);
 
+	      g_list_free (ctx->include_modules);
+	      ctx->include_modules = NULL;
+
 	      ctx->modules = g_list_append (ctx->modules, ctx->current_module);
 	      ctx->current_module->dependencies = ctx->dependencies;
-	      ctx->current_module->include_modules = g_list_copy (ctx->include_modules);
 
 	      state_switch (ctx, STATE_NAMESPACE);
 	      goto out;
@@ -3028,6 +3030,7 @@
   ctx.parser = parser;
   ctx.state = STATE_START;
   ctx.namespace = namespace;
+  ctx.include_modules = NULL;
   ctx.aliases = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
   ctx.disguised_structures = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
   ctx.type_depth = 0;
@@ -3055,12 +3058,14 @@
 
   if (ctx.modules == NULL)
     {
-      /* If we have a module, then ownership is transferred to the module */
-
+      /* An error occurred before we created a module, so we haven't
+       * transferred ownership of these hash tables to the module.
+       */
       if (ctx.aliases != NULL)
 	g_hash_table_destroy (ctx.aliases);
       if (ctx.disguised_structures != NULL)
 	g_hash_table_destroy (ctx.disguised_structures);
+      g_list_free (ctx.include_modules);
     }
   
   g_markup_parse_context_free (context);



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