summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <matthiasc@src.gnome.org>2008-12-02 05:14:00 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2008-12-02 05:14:00 +0000
commit6537b5e11d87b6a9bce4ce1e73e7a6f4cb01c1ce (patch)
tree3379328b3bf2507f0c5e10bede01310dcdc66027
parent26a4a31b1ac8fcbe80e3b0b21150c4b705925182 (diff)
downloadglib-6537b5e11d87b6a9bce4ce1e73e7a6f4cb01c1ce.tar.gz
Always reset the use count to its previous value before returning FALSE.
* gtypemodule.c (g_type_module_use): Always reset the use count to its previous value before returning FALSE. Pointed out by Johan Billien. svn path=/trunk/; revision=7725
-rw-r--r--gobject/ChangeLog9
-rw-r--r--gobject/gtypemodule.c3
2 files changed, 12 insertions, 0 deletions
diff --git a/gobject/ChangeLog b/gobject/ChangeLog
index 8d6ec59be..13697bdee 100644
--- a/gobject/ChangeLog
+++ b/gobject/ChangeLog
@@ -1,3 +1,12 @@
+2008-12-02 Matthias Clasen <mclasen@redhat.com>
+
+ Bug 473150 – g_type_module_use inconsistently increases the use
+ counter in case of error
+
+ * gtypemodule.c (g_type_module_use): Always reset the use count
+ to its previous value before returning FALSE. Pointed out by
+ Johan Billien.
+
2008-12-01 Matthias Clasen <mclasen@redhat.com>
* === Released 2.19.2 ===
diff --git a/gobject/gtypemodule.c b/gobject/gtypemodule.c
index 07e315770..1ba64ade3 100644
--- a/gobject/gtypemodule.c
+++ b/gobject/gtypemodule.c
@@ -238,6 +238,8 @@ g_type_module_find_interface_info (GTypeModule *module,
*
* Increases the use count of a #GTypeModule by one. If the
* use count was zero before, the plugin will be loaded.
+ * If loading the plugin fails, the use count is reset to
+ * its prior value.
*
* Returns: %FALSE if the plugin needed to be loaded and
* loading the plugin failed.
@@ -267,6 +269,7 @@ g_type_module_use (GTypeModule *module)
g_warning ("plugin '%s' failed to register type '%s'\n",
module->name ? module->name : "(unknown)",
g_type_name (type_info->type));
+ module->use_count--;
return FALSE;
}