From f9730106d76bc6f803affdbb23a48f3ef9a4f2d1 Mon Sep 17 00:00:00 2001 From: Martin Schulze Date: Sun, 1 Aug 2004 16:16:44 +0000 Subject: Move deletion of SourceConnectionNode object into 2004-07-23 Martin Schulze * glib/glibmm/main.cc: Move deletion of SourceConnectionNode object into destroy_notify_callback() exclusively; do not delete from notify(). (bug #144420) --- ChangeLog | 6 ++++++ glib/glibmm/main.cc | 9 +++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1421e0cc..6f91e8b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-07-23 Martin Schulze + + * glib/glibmm/main.cc: Move deletion of SourceConnectionNode object + into destroy_notify_callback() exclusively; do not delete from notify(). + (bug #144420) + 2004-07-10 Murray Cumming * glib/glibmm/signalproxy_connectionnode.cc: notify(): Do not delete diff --git a/glib/glibmm/main.cc b/glib/glibmm/main.cc index 26b26bca..41dd351a 100644 --- a/glib/glibmm/main.cc +++ b/glib/glibmm/main.cc @@ -62,14 +62,16 @@ void* SourceConnectionNode::notify(void* data) { SourceConnectionNode *const self = static_cast(data); - // if there is no object, this call was triggered from destroy_notify_handler(). + // if there is no object, this call was triggered from destroy_notify_handler(), + // because we set self->source_ to 0 there: if (self->source_) { GSource* s = self->source_; self->source_ = 0; g_source_destroy(s); - delete self; + // Destroying the object triggers execution of destroy_notify_handler(), + // eiter immediately or later, so we leave that to do the deletion. } return 0; @@ -80,8 +82,7 @@ void SourceConnectionNode::destroy_notify_callback(void* data) { SourceConnectionNode *const self = static_cast(data); - // if there is no object, this call was triggered from notify(). - if (self->source_) + if (self) { // The GLib side is disconnected now, thus the GSource* is no longer valid. self->source_ = 0; -- cgit v1.2.1