perl-Glib r1073 - branches/stable-1-20



Author: tsch
Date: Thu Feb  5 13:59:42 2009
New Revision: 1073
URL: http://svn.gnome.org/viewvc/perl-Glib?rev=1073&view=rev

Log:
Merge r1072 from trunk.


Modified:
   branches/stable-1-20/   (props changed)
   branches/stable-1-20/ChangeLog
   branches/stable-1-20/GBoxed.xs
   branches/stable-1-20/GObject.xs
   branches/stable-1-20/GType.xs

Modified: branches/stable-1-20/GBoxed.xs
==============================================================================
--- branches/stable-1-20/GBoxed.xs	(original)
+++ branches/stable-1-20/GBoxed.xs	Thu Feb  5 13:59:42 2009
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003-2005 by the gtk2-perl team (see the file AUTHORS for
+ * Copyright (C) 2003-2005, 2009 by the gtk2-perl team (see the file AUTHORS for
  * the full list)
  *
  * This library is free software; you can redistribute it and/or modify it
@@ -186,12 +186,17 @@
 						         NULL);
 	}
 	boxed_info = boxed_info_new (gtype, package, wrapper_class);
+
 	/* We need to insert into info_by_package first because there might
 	 * otherwise be trouble if we overwrite an entry: inserting into
 	 * info_by_gtype frees the boxed_info of the overwritten entry, so that
 	 * boxed_info->package is no longer valid at this point.
+	 *
+	 * Note also it's g_hash_table_replace() for info_by_package,
+	 * because the old key string in the old boxed_info will be freed
+	 * when info_by_gtype updates the value there.
 	 */
-	g_hash_table_insert (info_by_package, boxed_info->package, boxed_info);
+	g_hash_table_replace (info_by_package, boxed_info->package, boxed_info);
 	g_hash_table_insert (info_by_gtype, (gpointer) gtype, boxed_info);
 
 	/* GBoxed types are plain structures, so it would be really

Modified: branches/stable-1-20/GObject.xs
==============================================================================
--- branches/stable-1-20/GObject.xs	(original)
+++ branches/stable-1-20/GObject.xs	Thu Feb  5 13:59:42 2009
@@ -329,12 +329,17 @@
 							  NULL);
 	}
 	class_info = class_info_new (gtype, package);
+
 	/* We need to insert into types_by_package first because there might
 	 * otherwise be trouble if we overwrite an entry: inserting into
-	 * types_by_gtype frees the class_info of the overwritten entry, so
+	 * types_by_type frees the class_info of the overwritten entry, so
 	 * that class_info->package is no longer valid at this point.
+	 *
+	 * Note also it's g_hash_table_replace() for types_by_package,
+	 * because the old key string in the old class_info will be freed
+	 * when types_by_type updates the value there.
 	 */
-	g_hash_table_insert (types_by_package, class_info->package, class_info);
+	g_hash_table_replace (types_by_package, class_info->package, class_info);
 	g_hash_table_insert (types_by_type,
 	                     (gpointer) class_info->gtype, class_info);
 	/* warn ("registered class %s to package %s\n", class_info->class, class_info->package); */

Modified: branches/stable-1-20/GType.xs
==============================================================================
--- branches/stable-1-20/GType.xs	(original)
+++ branches/stable-1-20/GType.xs	Thu Feb  5 13:59:42 2009
@@ -98,8 +98,12 @@
 	/* We need to insert into types_by_package first because there might
 	 * otherwise be trouble if we overwrite an entry: inserting into
 	 * packages_by_type frees the copied package name.
+	 *
+	 * Note also it's g_hash_table_replace() for types_by_package, because
+	 * the old key string will be freed when packages_by_type updates the
+	 * value there.
 	 */
-	g_hash_table_insert (types_by_package, p, (gpointer) gtype);
+	g_hash_table_replace (types_by_package, p, (gpointer) gtype);
 	g_hash_table_insert (packages_by_type, (gpointer) gtype, p);
 	G_UNLOCK (types_by_package);
 	G_UNLOCK (packages_by_type);



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