diff --git a/libs/widgets/frame.cc b/libs/widgets/frame.cc index 6cd16dfb1f..1b3d25c289 100644 --- a/libs/widgets/frame.cc +++ b/libs/widgets/frame.cc @@ -60,6 +60,8 @@ Frame::~Frame () _parent_style_change.disconnect (); } if (_w) { + g_signal_handler_disconnect (_w->gobj(), _destroy_connection); + /* This is manly for the benefit of macOS GLCanvas (see also EventBoxExt) */ _w->unparent (); } } @@ -68,6 +70,7 @@ void Frame::child_destroyed (GtkWidget*, gpointer data) { Frame* self = static_cast(data); + g_signal_handler_disconnect (self->_w->gobj(), self->_destroy_connection); self->_w = 0; } @@ -80,7 +83,8 @@ Frame::on_add (Widget* w) Bin::on_add (w); _w = w; - g_signal_connect (w->gobj(), "destroy", G_CALLBACK(child_destroyed), this); + + _destroy_connection = g_signal_connect_after (w->gobj(), "destroy", G_CALLBACK(child_destroyed), this); queue_resize (); } @@ -89,6 +93,9 @@ Frame::on_remove (Gtk::Widget* w) { Bin::on_remove (w); assert (_w == w); + if (_w) { + g_signal_handler_disconnect (_w->gobj(), _destroy_connection); + } _w = 0; } diff --git a/libs/widgets/widgets/frame.h b/libs/widgets/widgets/frame.h index 5a1ef00e14..824c70a741 100644 --- a/libs/widgets/widgets/frame.h +++ b/libs/widgets/widgets/frame.h @@ -81,6 +81,8 @@ private: int _alloc_y0; bool _boxy; bool _draw; + + gulong _destroy_connection; }; } // namespace ArdourWidgets