/soc/2013/ankitkv/gobjectification: a0d82b6f4081: Removed refere...

Ankit Vani a at nevitus.org
Thu Aug 1 07:11:34 EDT 2013


Changeset: a0d82b6f408108bf1e5fdaf766bab866d5b23815
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-08-01 16:39 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/a0d82b6f4081

Description:

Removed referencing of plugin from PurplePluginAction, since it is a part of the plugin.

diffstat:

 libpurple/plugins.c |  9 +++++----
 libpurple/plugins.h |  2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diffs (53 lines):

diff --git a/libpurple/plugins.c b/libpurple/plugins.c
--- a/libpurple/plugins.c
+++ b/libpurple/plugins.c
@@ -142,7 +142,7 @@ purple_plugin_add_action(GPluginPlugin *
 
 	action->label    = g_strdup(label);
 	action->callback = callback;
-	action->plugin   = g_object_ref(plugin);
+	action->plugin   = plugin;
 
 	priv->actions = g_list_append(priv->actions, action);
 
@@ -313,7 +313,6 @@ purple_plugin_action_free(PurplePluginAc
 	g_return_if_fail(action != NULL);
 
 	g_free(action->label);
-	g_object_unref(action->plugin);
 	g_free(action);
 }
 
@@ -328,7 +327,7 @@ purple_plugin_action_copy(PurplePluginAc
 
 	action_copy->label    = g_strdup(action->label);
 	action_copy->callback = action->callback;
-	action_copy->plugin   = g_object_ref(action->plugin);
+	action_copy->plugin   = action->plugin;
 
 	return action_copy;
 }
@@ -396,8 +395,10 @@ purple_plugins_find_by_filename(const ch
 	for (l = plugins; l != NULL; l = l->next) {
 		GPluginPlugin *plugin = GPLUGIN_PLUGIN(l->data);
 
-		if (purple_strequal(gplugin_plugin_get_filename(plugin), filename))
+		if (purple_strequal(gplugin_plugin_get_filename(plugin), filename)) {
+			purple_plugins_free_found_list(plugins);
 			return g_object_ref(plugin);
+		}
 	}
 	purple_plugins_free_found_list(plugins);
 
diff --git a/libpurple/plugins.h b/libpurple/plugins.h
--- a/libpurple/plugins.h
+++ b/libpurple/plugins.h
@@ -233,7 +233,7 @@ GList *purple_plugins_get_loaded(void);
  *
  * @param filename The plugin filename.
  *
- * @return The plugin if found, or @c NULL if not found.
+ * @return The referenced plugin if found, or @c NULL if not found.
  */
 GPluginPlugin *purple_plugins_find_by_filename(const char *filename);
 



More information about the Commits mailing list