From 9e981367e2cf27cf0d19914e03f55a8c405c7188 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 21 Aug 2016 22:08:54 +0200 Subject: [PATCH] Fix another crash at exit: Collecting bindings after ::finish() has already destroyed half the GUI will result in memory corruption invalid Glib::RefPtr Gtkmm2ext::ActionMap::get_actions() Gtkmm2ext::Bindings::get_all_actions() KeyEditor::Tab::populate() KeyEditor::refresh() Editor::set_script_action_name() LuaInstance::session_going_away() PBD::Destructible::drop_references() ARDOUR::Session::destroy() ARDOUR::Session::~Session() ARDOUR_UI::finish() --- gtk2_ardour/ardour_ui.cc | 2 ++ gtk2_ardour/keyeditor.cc | 2 +- gtk2_ardour/keyeditor.h | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index e9cf5b2041..6190d9d2d4 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -1284,6 +1284,8 @@ If you still wish to quit, please use the\n\n\ */ save_ardour_state (); + key_editor->disconnect (); + close_all_dialogs (); if (_session) { diff --git a/gtk2_ardour/keyeditor.cc b/gtk2_ardour/keyeditor.cc index b19b6d5fc0..aea8185f3b 100644 --- a/gtk2_ardour/keyeditor.cc +++ b/gtk2_ardour/keyeditor.cc @@ -122,7 +122,7 @@ KeyEditor::KeyEditor () add (vpacker); unbind_button.set_sensitive (false); - UpdateBindings.connect (sigc::mem_fun (*this, &KeyEditor::refresh)); + _refresh_connection = UpdateBindings.connect (sigc::mem_fun (*this, &KeyEditor::refresh)); } void diff --git a/gtk2_ardour/keyeditor.h b/gtk2_ardour/keyeditor.h index a5662333ce..3e4c5d068c 100644 --- a/gtk2_ardour/keyeditor.h +++ b/gtk2_ardour/keyeditor.h @@ -45,6 +45,10 @@ class KeyEditor : public ArdourWindow static sigc::signal UpdateBindings; + void disconnect () { + _refresh_connection.disconnect (); + } + private: class Tab : public Gtk::VBox { @@ -124,6 +128,8 @@ class KeyEditor : public ArdourWindow void toggle_sort_type (); void search_string_updated (const std::string&); void print () const; + + sigc::connection _refresh_connection; }; #endif /* __ardour_gtk_key_editor_h__ */