[monet/monet-xml] monet-gtk: prevent crashes if the module is re-loaded
- From: Thomas Wood <thos src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [monet/monet-xml] monet-gtk: prevent crashes if the module is re-loaded
- Date: Sat, 11 Sep 2010 17:28:02 +0000 (UTC)
commit 81dfcebc8a199e229f93ba5bde9c559fc9d200b0
Author: Thomas Wood <thos gnome org>
Date: Sat Sep 4 17:15:59 2010 +0100
monet-gtk: prevent crashes if the module is re-loaded
Ensure that the module is kept resident because dependant libraries
register non-dynamic types. Also make sure that dynamic types are
re-registered when needed.
monet-gtk/main.c | 2 ++
monet-gtk/rcstyle.c | 4 +---
monet-gtk/style.c | 12 +++++-------
3 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/monet-gtk/main.c b/monet-gtk/main.c
index 9116624..7a039ee 100644
--- a/monet-gtk/main.c
+++ b/monet-gtk/main.c
@@ -55,6 +55,8 @@ theme_create_rc_style (void)
const gchar*
g_module_check_init (GModule *module)
{
+ g_module_make_resident (module);
+
return gtk_check_version (GTK_MAJOR_VERSION,
GTK_MINOR_VERSION,
GTK_MICRO_VERSION - GTK_INTERFACE_AGE);
diff --git a/monet-gtk/rcstyle.c b/monet-gtk/rcstyle.c
index 25d16da..d89db82 100644
--- a/monet-gtk/rcstyle.c
+++ b/monet-gtk/rcstyle.c
@@ -34,8 +34,7 @@ GType monet_gtk_type_rc_style = 0;
void
monet_gtk_rc_style_register_type (GTypeModule *module)
{
- if (!monet_gtk_type_rc_style) {
- static const GTypeInfo object_info =
+ static const GTypeInfo object_info =
{
sizeof (MonetGtkRcStyleClass),
(GBaseInitFunc) NULL,
@@ -53,7 +52,6 @@ monet_gtk_rc_style_register_type (GTypeModule *module)
GTK_TYPE_RC_STYLE,
"MonetGtkRcStyle",
&object_info, 0);
- }
}
static void
diff --git a/monet-gtk/style.c b/monet-gtk/style.c
index df6d89b..52808c9 100644
--- a/monet-gtk/style.c
+++ b/monet-gtk/style.c
@@ -707,8 +707,7 @@ monet_gtk_style_init (GObject *self)
void
monet_gtk_style_register_type (GTypeModule * module)
{
- if (!monet_gtk_type_style) {
- static const GTypeInfo object_info =
+ static const GTypeInfo object_info =
{
sizeof (MonetGtkStyleClass),
(GBaseInitFunc) NULL,
@@ -722,9 +721,8 @@ monet_gtk_style_register_type (GTypeModule * module)
NULL
};
- monet_gtk_type_style = g_type_module_register_type (module,
- GTK_TYPE_STYLE,
- "MonetGtkStyle",
- &object_info, 0);
- }
+ monet_gtk_type_style = g_type_module_register_type (module,
+ GTK_TYPE_STYLE,
+ "MonetGtkStyle",
+ &object_info, 0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]