Add a variable to save the handler of the timestamp changed signal

This commit is contained in:
Gergely Polonkai 2014-10-07 23:24:11 +02:00
parent 46b6b86f88
commit 2dd4ea1ca7

View File

@ -83,6 +83,7 @@ struct _GsweMomentPrivate {
guint aspect_revision; guint aspect_revision;
GList *antiscia_list; GList *antiscia_list;
guint antiscia_revision; guint antiscia_revision;
gulong timestamp_signal_handler;
}; };
enum { enum {
@ -269,10 +270,9 @@ gswe_moment_dispose(GObject *gobject)
{ {
GsweMoment *moment = GSWE_MOMENT(gobject); GsweMoment *moment = GSWE_MOMENT(gobject);
g_signal_handlers_disconnect_by_func( g_signal_handler_disconnect(
moment->priv->timestamp, moment->priv->timestamp,
gswe_moment_timestamp_changed, moment->priv->timestamp_signal_handler
NULL
); );
g_clear_object(&moment->priv->timestamp); g_clear_object(&moment->priv->timestamp);
@ -410,10 +410,9 @@ gswe_moment_set_timestamp(GsweMoment *moment, GsweTimestamp *timestamp)
} }
if (moment->priv->timestamp != NULL) { if (moment->priv->timestamp != NULL) {
g_signal_handlers_disconnect_by_func( g_signal_handler_disconnect(
moment->priv->timestamp, moment->priv->timestamp,
gswe_moment_timestamp_changed, moment->priv->timestamp_signal_handler
NULL
); );
g_clear_object(&moment->priv->timestamp); g_clear_object(&moment->priv->timestamp);
} }
@ -421,7 +420,7 @@ gswe_moment_set_timestamp(GsweMoment *moment, GsweTimestamp *timestamp)
moment->priv->revision++; moment->priv->revision++;
moment->priv->timestamp = timestamp; moment->priv->timestamp = timestamp;
g_object_ref(timestamp); g_object_ref(timestamp);
g_signal_connect( moment->priv->timestamp_signal_handler = g_signal_connect(
G_OBJECT(timestamp), G_OBJECT(timestamp),
"changed", "changed",
G_CALLBACK(gswe_moment_timestamp_changed), G_CALLBACK(gswe_moment_timestamp_changed),