[gedit-collaboration] Fix singleton implementation of plugin



commit 516c204eec05965ffa69e3105937106c47b19ab4
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date:   Sun Apr 3 17:09:33 2011 +0200

    Fix singleton implementation of plugin

 src/gedit-collaboration-plugin.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/src/gedit-collaboration-plugin.c b/src/gedit-collaboration-plugin.c
index f384cc0..3de6fcd 100644
--- a/src/gedit-collaboration-plugin.c
+++ b/src/gedit-collaboration-plugin.c
@@ -188,20 +188,22 @@ gedit_collaboration_plugin_constructor (GType                  type,
                                         guint                  n_parameters,
                                         GObjectConstructParam *parameters)
 {
-	GObject *ret;
+	GObjectClass *klass;
 
 	if (plugin_instance != NULL)
 	{
 		return g_object_ref (plugin_instance);
 	}
 
-	ret = G_OBJECT_CLASS (gedit_collaboration_plugin_parent_class)->constructor (type,
-	                                                                             n_parameters,
-	                                                                             parameters);
+	klass = G_OBJECT_CLASS (gedit_collaboration_plugin_parent_class);
+	plugin_instance = GEDIT_COLLABORATION_PLUGIN (klass->constructor (type,
+	                                                                  n_parameters,
+	                                                                  parameters));
 
-	g_object_add_weak_pointer (ret,
-	                           (gpointer *)&ret);
-	return ret;
+	g_object_add_weak_pointer (G_OBJECT (plugin_instance),
+	                           (gpointer *)&plugin_instance);
+
+	return G_OBJECT (plugin_instance);
 }
 
 static void



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