Revision: 4047 http://geany.svn.sourceforge.net/geany/?rev=4047&view=rev Author: ntrel Date: 2009-07-30 11:56:25 +0000 (Thu, 30 Jul 2009)
Log Message: ----------- Fix disconnecting plugin signal id when not using geany_object.
Modified Paths: -------------- trunk/ChangeLog trunk/src/pluginprivate.h trunk/src/plugins.c trunk/src/pluginutils.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-07-30 11:29:53 UTC (rev 4046) +++ trunk/ChangeLog 2009-07-30 11:56:25 UTC (rev 4047) @@ -11,6 +11,8 @@ tagmanager/parsers.h, tagmanager/makefile.win32, tagmanager/markdown.c, tagmanager/Makefile.am, wscript: Add Markdown filetype (patch by Jon Strait, thanks). + * src/pluginprivate.h, src/pluginutils.c, src/plugins.c: + Fix disconnecting plugin signal id when not using geany_object.
2009-07-29 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/pluginprivate.h =================================================================== --- trunk/src/pluginprivate.h 2009-07-30 11:29:53 UTC (rev 4046) +++ trunk/src/pluginprivate.h 2009-07-30 11:56:25 UTC (rev 4047) @@ -28,11 +28,18 @@
#include "ui_utils.h"
+typedef struct SignalConnection +{ + GObject *object; + gulong handler_id; +} +SignalConnection; + typedef struct GeanyPluginPrivate { GeanyAutoSeparator toolbar_separator; gboolean resident; - GArray *signal_ids; /* gulong signal IDs to disconnect when unloading */ + GArray *signal_ids; /* SignalConnection's to disconnect when unloading */ } GeanyPluginPrivate;
Modified: trunk/src/plugins.c =================================================================== --- trunk/src/plugins.c 2009-07-30 11:29:53 UTC (rev 4046) +++ trunk/src/plugins.c 2009-07-30 11:56:25 UTC (rev 4047) @@ -682,13 +682,13 @@ static void remove_callbacks(Plugin *plugin) { GArray *signal_ids = plugin->priv.signal_ids; - gulong *i; + SignalConnection *sc;
if (signal_ids == NULL) return;
- foreach_array(gulong, i, signal_ids) - g_signal_handler_disconnect(geany_object, *i); + foreach_array(SignalConnection, sc, signal_ids) + g_signal_handler_disconnect(sc->object, sc->handler_id);
g_array_free(signal_ids, TRUE); }
Modified: trunk/src/pluginutils.c =================================================================== --- trunk/src/pluginutils.c 2009-07-30 11:29:53 UTC (rev 4046) +++ trunk/src/pluginutils.c 2009-07-30 11:56:25 UTC (rev 4047) @@ -107,6 +107,7 @@ GCallback callback, gpointer user_data) { gulong id; + SignalConnection sc;
if (!object) object = geany_object; @@ -116,9 +117,11 @@ g_signal_connect(object, signal_name, callback, user_data);
if (!plugin->priv->signal_ids) - plugin->priv->signal_ids = g_array_new(FALSE, FALSE, sizeof(gulong)); + plugin->priv->signal_ids = g_array_new(FALSE, FALSE, sizeof(SignalConnection));
- g_array_append_val(plugin->priv->signal_ids, id); + sc.object = object; + sc.handler_id = id; + g_array_append_val(plugin->priv->signal_ids, sc); }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.