Amend 28c8dbf128, unsubscribe from destroyed signal

This handles another edge case where the Frame is deleted
before the child widget.
This commit is contained in:
Robin Gareus 2025-08-21 04:41:01 +02:00
parent e42cea63d5
commit d7af181037
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
2 changed files with 10 additions and 1 deletions

View file

@ -60,6 +60,8 @@ Frame::~Frame ()
_parent_style_change.disconnect (); _parent_style_change.disconnect ();
} }
if (_w) { if (_w) {
g_signal_handler_disconnect (_w->gobj(), _destroy_connection);
/* This is manly for the benefit of macOS GLCanvas (see also EventBoxExt) */
_w->unparent (); _w->unparent ();
} }
} }
@ -68,6 +70,7 @@ void
Frame::child_destroyed (GtkWidget*, gpointer data) Frame::child_destroyed (GtkWidget*, gpointer data)
{ {
Frame* self = static_cast<Frame*>(data); Frame* self = static_cast<Frame*>(data);
g_signal_handler_disconnect (self->_w->gobj(), self->_destroy_connection);
self->_w = 0; self->_w = 0;
} }
@ -80,7 +83,8 @@ Frame::on_add (Widget* w)
Bin::on_add (w); Bin::on_add (w);
_w = 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 (); queue_resize ();
} }
@ -89,6 +93,9 @@ Frame::on_remove (Gtk::Widget* w)
{ {
Bin::on_remove (w); Bin::on_remove (w);
assert (_w == w); assert (_w == w);
if (_w) {
g_signal_handler_disconnect (_w->gobj(), _destroy_connection);
}
_w = 0; _w = 0;
} }

View file

@ -81,6 +81,8 @@ private:
int _alloc_y0; int _alloc_y0;
bool _boxy; bool _boxy;
bool _draw; bool _draw;
gulong _destroy_connection;
}; };
} // namespace ArdourWidgets } // namespace ArdourWidgets