From 397c2d3338fbfaca09f0717b58c1154e91bbffff Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 20 Feb 2010 22:11:04 +0000 Subject: 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 --- src/gui/PropertiesWindow.cpp | 22 ++++++++++++++++------ src/gui/PropertiesWindow.hpp | 1 + 2 files changed, 17 insertions(+), 6 deletions(-) (limited to 'src') 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 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 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); -- cgit v1.2.1