[evolution] Bug #655507 - Do not unload extensions, keep them preloaded



commit 90f7050236c48d42c4b416748aede29265519f2d
Author: Milan Crha <mcrha redhat com>
Date:   Thu Aug 4 07:43:31 2011 +0200

    Bug #655507 - Do not unload extensions, keep them preloaded

 e-util/e-extensible.c |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/e-util/e-extensible.c b/e-util/e-extensible.c
index a7523de..6e49e9d 100644
--- a/e-util/e-extensible.c
+++ b/e-util/e-extensible.c
@@ -94,17 +94,19 @@ extensible_load_extension (GType extension_type,
 	extension_class = g_type_class_ref (extension_type);
 
 	/* Only load extensions that extend the given extensible object. */
-	if (!g_type_is_a (extensible_type, extension_class->extensible_type))
-		goto exit;
-
-	extension = g_object_new (
-		extension_type, "extensible", extensible, NULL);
-
-	extensions = extensible_get_extensions (extensible);
-	g_ptr_array_add (extensions, extension);
-
-exit:
-	g_type_class_unref (extension_class);
+	if (g_type_is_a (extensible_type, extension_class->extensible_type)) {
+		extension = g_object_new (
+			extension_type, "extensible", extensible, NULL);
+
+		extensions = extensible_get_extensions (extensible);
+		g_ptr_array_add (extensions, extension);
+
+		g_type_class_unref (extension_class);
+	} else {
+		/* keep the class referenced forever, later may anyone need it anyway,
+		   and unref it may mean module unload, which breaks static strings
+		   in GType */
+	}
 }
 
 static void



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