From c832235b1dc76af96cd2a9ac8b5127871f6bec6c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sat, 1 Sep 2007 04:34:22 +0000 Subject: r16406@tres: ted | 2007-08-29 20:14:55 -0700 Reroute the way that the preferences signal changes so that pinning works as expected. Fixes a segmentation fault. (bzr r3645) --- src/extension/prefdialog.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/extension/prefdialog.cpp') diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp index 7da2a9e29..cef642d50 100644 --- a/src/extension/prefdialog.cpp +++ b/src/extension/prefdialog.cpp @@ -38,7 +38,7 @@ namespace Extension { in the title. It adds a few buttons and sets up handlers for them. It also places the passed in widgets into the dialog. */ -PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * controls, ExecutionEnv * exEnv, Effect * effect) : +PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * controls, ExecutionEnv * exEnv, Effect * effect, sigc::signal * changeSignal) : Gtk::Dialog::Dialog(_(name.c_str()), true, true), _help(help), _name(name), @@ -50,7 +50,8 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co _button_pinned(NULL), _param_preview(NULL), _param_pinned(NULL), - _effect(effect) + _effect(effect), + _signal_param_change(changeSignal) { Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox()); hbox->pack_start(*controls, true, true, 6); @@ -182,7 +183,7 @@ PrefDialog::pinned_toggle (void) { _button_cancel->set_label(Gtk::Stock::CANCEL.id); if (_exEnv == NULL) { - _exEnv = new ExecutionEnv(_effect, SP_ACTIVE_DESKTOP, NULL, this); + _exEnv = new ExecutionEnv(_effect, SP_ACTIVE_DESKTOP, NULL, _signal_param_change, this); _createdExEnv = true; preview_toggle(); _exEnv->run(); @@ -201,6 +202,12 @@ PrefDialog::on_response (int signal) { if (signal == Gtk::RESPONSE_OK) { _effect->effect(SP_ACTIVE_DESKTOP); + } else { + this->hide(); + delete _signal_param_change; // This is not in the destructor because + // it is the only situation that we need + // to delete it in + delete this; } this->hide(); -- cgit v1.2.3