Fix another crash at exit:
authorRobin Gareus <robin@gareus.org>
Sun, 21 Aug 2016 20:08:54 +0000 (22:08 +0200)
committerRobin Gareus <robin@gareus.org>
Sun, 21 Aug 2016 21:02:37 +0000 (23:02 +0200)
Collecting bindings after ::finish() has already destroyed half the GUI
will result in memory corruption invalid Glib::RefPtr<Gtk::Action>

 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
gtk2_ardour/keyeditor.cc
gtk2_ardour/keyeditor.h

index e9cf5b204100d3a5250d388edebc9ce83102c6a0..6190d9d2d48fc1706c483be1e75df8c7ea086ffa 100644 (file)
@@ -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) {
index b19b6d5fc009611b321026bac56e61bf0d1aecfe..aea8185f3bc5758456fbbadf5baf37ba816e5fbc 100644 (file)
@@ -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
index a5662333ce2e5e2a115a47fe68c563595bba6d20..3e4c5d068ccdc460f69c4ac2c90d24f8d4f01851 100644 (file)
@@ -45,6 +45,10 @@ class KeyEditor : public ArdourWindow
 
        static sigc::signal<void> 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__ */