From b55e94ced47c5a738d76ebf75b536666cf9055ef Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 13 Aug 2024 21:07:51 +0200 Subject: [PATCH] Fix crash when deleting route while creating a routegroup for it This reverts 00e35c48b67cc081cc. Modal dialog does not allow to change the color of the RouteGroup. Interaction with the colorpicker was not possible. See also 0db79b80234a3f --- gtk2_ardour/group_tabs.cc | 9 ++++++++- gtk2_ardour/group_tabs.h | 2 ++ gtk2_ardour/route_group_dialog.cc | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/group_tabs.cc b/gtk2_ardour/group_tabs.cc index d13d08410e..585ff16c15 100644 --- a/gtk2_ardour/group_tabs.cc +++ b/gtk2_ardour/group_tabs.cc @@ -698,7 +698,13 @@ GroupTabs::run_new_group_dialog (RouteList const * rl, bool with_master) } RouteGroup* g = new RouteGroup (*_session, ""); - RouteGroupDialog* d = new RouteGroupDialog (g, true); + RouteGroupDialog* d = new RouteGroupDialog (g, true); // XXX + + if (rl) { + for (auto const& r : *rl) { + r->DropReferences.connect (_new_route_group_connection, invalidator (*d), boost::bind (&Dialog::response, d, RESPONSE_CANCEL), gui_context()); + } + } d->signal_response().connect (sigc::bind (sigc::mem_fun (*this, &GroupTabs::new_group_dialog_finished), d, rl ? new RouteList (*rl): 0, with_master)); d->present (); @@ -707,6 +713,7 @@ GroupTabs::run_new_group_dialog (RouteList const * rl, bool with_master) void GroupTabs::new_group_dialog_finished (int r, RouteGroupDialog* d, RouteList const * rl, bool with_master) const { + _new_route_group_connection.disconnect (); if (r == RESPONSE_OK) { if (!d->name_check()) { diff --git a/gtk2_ardour/group_tabs.h b/gtk2_ardour/group_tabs.h index a5f6dabe57..2b29b421c1 100644 --- a/gtk2_ardour/group_tabs.h +++ b/gtk2_ardour/group_tabs.h @@ -178,6 +178,8 @@ private: bool _hovering; + mutable PBD::ScopedConnection _new_route_group_connection; + /** colors that have been used for new route group tabs */ static std::list _used_colors; }; diff --git a/gtk2_ardour/route_group_dialog.cc b/gtk2_ardour/route_group_dialog.cc index d0ad33eae8..83b9c0211e 100644 --- a/gtk2_ardour/route_group_dialog.cc +++ b/gtk2_ardour/route_group_dialog.cc @@ -42,7 +42,7 @@ using namespace std; using namespace PBD; RouteGroupDialog::RouteGroupDialog (RouteGroup* g, bool creating_new) - : ArdourDialog (_("Track/bus Group"), creating_new) + : ArdourDialog (_("Track/bus Group")) , _group (g) , _initial_name (g->name ()) , _active (_("Active"))