gobjectification: 8bbcfe04: Add a new 'destroying' signal for purple...
sadrul at pidgin.im
sadrul at pidgin.im
Tue Jul 6 01:57:16 EDT 2010
----------------------------------------------------------------------
Revision: 8bbcfe0485b9c93e124e574ddeecb5f1c19e02d2
Parent: a3f8942b60a7391285e60f4cca8d4f4fd64c2456
Author: sadrul at pidgin.im
Date: 07/05/10 23:14:25
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/8bbcfe0485b9c93e124e574ddeecb5f1c19e02d2
Changelog:
Add a new 'destroying' signal for purple-objects.
Changes against parent a3f8942b60a7391285e60f4cca8d4f4fd64c2456
patched libpurple/pobject.c
-------------- next part --------------
============================================================
--- libpurple/pobject.c b6b4d35699e20131212d0d9a336179f49e99da96
+++ libpurple/pobject.c b92f13ab1f62397ba0fc6afc0e3a5ca3e8c592b4
@@ -29,8 +29,10 @@ enum
enum
{
SIG_NEW,
+ SIG_DESTROYING,
SIG_LAST
};
+
static guint signals[SIG_LAST] = {0, };
static GObjectClass *parent_class;
@@ -40,6 +42,8 @@ purple_object_dispose(GObject *obj)
{
PurpleObject *pobj = PURPLE_OBJECT(obj);
+ g_signal_emit(pobj, signals[SIG_DESTROYING], 0);
+
if (pobj->priv->proto_data) {
g_warning("Purple-Object: object destroyed without unsetting the protocol data. This may lead to memory leak.\n");
}
@@ -70,6 +74,12 @@ purple_object_class_init(PurpleObjectCla
G_SIGNAL_ACTION, 0, NULL, NULL,
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+ /* This signal should be emitted just before the object is destroyed.
+ * So the callback should be able to query the object for various information. */
+ signals[SIG_DESTROYING] = g_signal_new("destroying", G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_ACTION, 0, NULL, NULL,
+ g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+
g_type_class_add_private(klass, sizeof(PurpleObjectPrivate));
}
More information about the Commits
mailing list