Clarify docs on the return. Fix a memory leak if a type with a value table

Mon Aug 25 14:16:48 2003  Owen Taylor  <otaylor@redhat.com>

        * gtypemodule.c (g_type_module_register_type): Clarify
        docs on the return. Fix a memory leak if a type with a
        value table is reloaded.
This commit is contained in:
Owen Taylor
2003-08-25 18:23:58 +00:00
committed by Owen Taylor
parent 23137b79d9
commit 5e88cedf02
3 changed files with 16 additions and 2 deletions

View File

@@ -111,11 +111,16 @@ Sets the name for a #GTypeModule
<!-- ##### FUNCTION g_type_module_register_type ##### --> <!-- ##### FUNCTION g_type_module_register_type ##### -->
<para> <para>
Looks up or registers a type that is implemented with a particular Looks up or registers a type that is implemented with a particular
type plugin. If a type with name @type_name is already registered, type plugin. If a type with name @type_name was previously registered,
the #GType identifier for the type is returned, otherwise the type the #GType identifier for the type is returned, otherwise the type
is newly registered, and the resulting #GType identifier returned. is newly registered, and the resulting #GType identifier returned.
</para> </para>
<para> <para>
When reregistering a type (typically because a module is unloaded
then reloaded, and reinitialized), @module and @parent_type must
be the same as they were previously.
</para>
<para>
As long as any instances of the type exist, the type plugin will As long as any instances of the type exist, the type plugin will
not be unloaded. not be unloaded.
</para> </para>
@@ -125,7 +130,7 @@ not be unloaded.
@type_name: name for the type @type_name: name for the type
@type_info: type information structure @type_info: type information structure
@flags: flags field providing details about the type @flags: flags field providing details about the type
@Returns: the type ID for the class. @Returns: the new or existing type ID
<!-- ##### FUNCTION g_type_module_add_interface ##### --> <!-- ##### FUNCTION g_type_module_add_interface ##### -->

View File

@@ -1,3 +1,9 @@
Mon Aug 25 14:16:48 2003 Owen Taylor <otaylor@redhat.com>
* gtypemodule.c (g_type_module_register_type): Clarify
docs on the return. Fix a memory leak if a type with a
value table is reloaded.
Tue Aug 19 05:21:04 2003 Tim Janik <timj@gtk.org> Tue Aug 19 05:21:04 2003 Tim Janik <timj@gtk.org>
* testgobject.c (main): check private instance data after * testgobject.c (main): check private instance data after

View File

@@ -316,6 +316,9 @@ g_type_module_register_type (GTypeModule *module,
parent_type_name ? parent_type_name : "(unknown)"); parent_type_name ? parent_type_name : "(unknown)");
return 0; return 0;
} }
if (module_type_info->info.value_table)
g_free (odule_type_info->info.value_table);
} }
else else
{ {