diff options
author | David Robillard <d@drobilla.net> | 2010-02-20 22:11:04 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-02-20 22:11:04 +0000 |
commit | 397c2d3338fbfaca09f0717b58c1154e91bbffff (patch) | |
tree | 8f67c1246ccad50b91e81fadfc5e44fa40bb17f3 | |
parent | 46e5de590817756b21a7a5d99bd4963df343f455 (diff) | |
download | ingen-397c2d3338fbfaca09f0717b58c1154e91bbffff.tar.gz ingen-397c2d3338fbfaca09f0717b58c1154e91bbffff.tar.bz2 ingen-397c2d3338fbfaca09f0717b58c1154e91bbffff.zip |
Reset PropertiesWindow on hide (fix crashes when modifying objects formerly shown by properties window). Likely fix for ticket #483.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2469 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | src/gui/PropertiesWindow.cpp | 22 | ||||
-rw-r--r-- | src/gui/PropertiesWindow.hpp | 1 |
2 files changed, 17 insertions, 6 deletions
diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp index 8890770a..44c1c774 100644 --- a/src/gui/PropertiesWindow.cpp +++ b/src/gui/PropertiesWindow.cpp @@ -64,17 +64,27 @@ PropertiesWindow::PropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<G } -/** Set the node this window is associated with. - * This function MUST be called before using this object in any way. - */ void -PropertiesWindow::set_object(SharedPtr<ObjectModel> model) +PropertiesWindow::reset() { _table->children().clear(); _table->resize(1, 3); _table->property_n_rows() = 1; + _records.clear(); + _property_connection.disconnect(); + _model.reset(); +} + + +/** Set the node this window is associated with. + * This function MUST be called before using this object in any way. + */ +void +PropertiesWindow::set_object(SharedPtr<ObjectModel> model) +{ + reset(); _model = model; set_title(model->path().chop_scheme() + " Properties - Ingen"); @@ -264,7 +274,7 @@ bad_type: void PropertiesWindow::cancel_clicked() { - set_object(_model); // reset + reset(); Gtk::Window::hide(); } @@ -295,7 +305,7 @@ void PropertiesWindow::ok_clicked() { apply_clicked(); - Gtk::Window::hide(); + cancel_clicked(); } diff --git a/src/gui/PropertiesWindow.hpp b/src/gui/PropertiesWindow.hpp index e4c7b962..079fa81b 100644 --- a/src/gui/PropertiesWindow.hpp +++ b/src/gui/PropertiesWindow.hpp @@ -67,6 +67,7 @@ private: Gtk::Widget* create_value_widget(const Raul::URI& uri, const Raul::Atom& value); + void reset(); void on_show(); void property_changed(const Raul::URI& predicate, const Raul::Atom& value); |