[gegl] buffer-source: Correctly store result of g_signal_connect
- From: Jon Nordby <jonnor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] buffer-source: Correctly store result of g_signal_connect
- Date: Sun, 6 May 2012 02:50:59 +0000 (UTC)
commit d9a636391c5004c2d54d11c2f9274c4f22bf14c8
Author: Jon Nordby <jononor gmail com>
Date: Sun May 6 04:48:07 2012 +0200
buffer-source: Correctly store result of g_signal_connect
Also add assertions to validate the invariant we rely on.
operations/common/buffer-source.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/operations/common/buffer-source.c b/operations/common/buffer-source.c
index 03f5822..4d414c1 100644
--- a/operations/common/buffer-source.c
+++ b/operations/common/buffer-source.c
@@ -89,11 +89,13 @@ my_set_property (GObject *gobject,
{
case PROP_buffer:
if (o->buffer) {
+ // Invariant: valid buffer should always have valid signal handler
+ g_assert(p->buffer_changed_handler > 0);
g_signal_handler_disconnect (o->buffer, p->buffer_changed_handler);
}
buffer = G_OBJECT (g_value_get_object (value));
if (buffer) {
- g_signal_connect (buffer, "changed", G_CALLBACK(buffer_changed), operation);
+ p->buffer_changed_handler = g_signal_connect (buffer, "changed", G_CALLBACK(buffer_changed), operation);
}
break;
default:
@@ -140,6 +142,8 @@ dispose (GObject *object)
if (o->buffer)
{
+ // Invariant: valid buffer should always have valid signal handler
+ g_assert(p->buffer_changed_handler > 0);
g_signal_handler_disconnect (o->buffer, p->buffer_changed_handler);
g_object_unref (o->buffer);
o->buffer = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]