summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 85d441f)
raw | patch | inline | side by side (parent: 85d441f)
author | gouldtj <gouldtj@users.sourceforge.net> | |
Sat, 1 Sep 2007 04:34:22 +0000 (04:34 +0000) | ||
committer | gouldtj <gouldtj@users.sourceforge.net> | |
Sat, 1 Sep 2007 04:34:22 +0000 (04:34 +0000) |
Reroute the way that the preferences signal changes so that pinning
works as expected. Fixes a segmentation fault.
works as expected. Fixes a segmentation fault.
index fc8715248edc09f14cac2a4a8fbdbda2d0da75b2..a20f1c6e93dc4ef596e74100448a0137b1a34387 100644 (file)
--- a/src/extension/effect.cpp
+++ b/src/extension/effect.cpp
set_state(Extension::STATE_LOADED);
if (!loaded()) return false;
- sigc::signal<void> changeSignal;
+ sigc::signal<void> * changeSignal = new sigc::signal<void>;
Gtk::Widget * controls;
- controls = imp->prefs_effect(this, doc, &changeSignal);
+ controls = imp->prefs_effect(this, doc, changeSignal);
- ExecutionEnv executionEnv(this, doc, controls);
- changeSignal.connect(sigc::mem_fun(executionEnv, &ExecutionEnv::preferencesChange));
+ ExecutionEnv executionEnv(this, doc, controls, changeSignal);
timer->lock();
executionEnv.run();
index 666270d5fdd3fdd6e7dd10a94e33e7442613e99c..caef5033a9fe90538b109bb583b1970b9de9fa63 100644 (file)
namespace Extension {
-ExecutionEnv::ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Gtk::Widget * controls, Gtk::Dialog * prefDialog) :
+ExecutionEnv::ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Gtk::Widget * controls, sigc::signal<void> * changeSignal, Gtk::Dialog * prefDialog) :
_visibleDialog(NULL),
_effect(effect),
_prefsVisible(false),
_prefsChanged(false),
_livePreview(true),
_selfdelete(false),
+ _changeSignal(changeSignal),
_doc(doc) {
SPDesktop *desktop = (SPDesktop *)_doc;
@@ -67,15 +68,23 @@ ExecutionEnv::ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Gtk
_visibleDialog = prefDialog;
_prefsVisible = true;
}
+
+ if (_changeSignal != NULL) {
+ _changesig = _changeSignal->connect(sigc::mem_fun(this, &ExecutionEnv::preferencesChange));
+ }
return;
}
ExecutionEnv::~ExecutionEnv (void) {
_dialogsig.disconnect();
+ _changesig.disconnect();
if (_visibleDialog != NULL && !_shutdown) {
delete _visibleDialog;
}
+ if (_changeSignal != NULL && !_shutdown) {
+ delete _changeSignal;
+ }
return;
}
void
ExecutionEnv::createPrefsDialog (Gtk::Widget * controls) {
- if (_visibleDialog != NULL) {
- delete _visibleDialog;
- }
-
- _visibleDialog = new PrefDialog(_effect->get_name(), _effect->get_help(), controls, this, _effect);
+ _visibleDialog = new PrefDialog(_effect->get_name(), _effect->get_help(), controls, this, _effect, _changeSignal);
_visibleDialog->signal_response().connect(sigc::mem_fun(this, &ExecutionEnv::preferencesResponse));
_visibleDialog->show();
_dialogsig = _visibleDialog->signal_response().connect(sigc::mem_fun(this, &ExecutionEnv::preferencesResponse));
if (_visibleDialog != NULL) {
delete _visibleDialog;
}
+ if (_changeSignal != NULL) {
+ delete _changeSignal;
+ }
gchar * dlgmessage = g_strdup_printf(_("'%s' working, please wait..."), _effect->get_name());
_visibleDialog = new Gtk::MessageDialog(dlgmessage,
index 5758658f32662a19c6806dbe71672ce2bc69fdc4..85e97ef18b96cd333e8f006584716d7e1bd3ba9f 100644 (file)
bool _prefsChanged;
bool _livePreview;
bool _selfdelete;
+ sigc::signal<void> * _changeSignal;
Glib::RefPtr<Glib::MainLoop> _mainloop;
Inkscape::UI::View::View * _doc;
std::list<Glib::ustring> _selected;
sigc::connection _dialogsig;
+ sigc::connection _changesig;
public:
Effect * _effect;
- ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Gtk::Widget * controls = NULL, Gtk::Dialog * prefDialog = NULL);
+ ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Gtk::Widget * controls = NULL, sigc::signal<void> * changeSignal = NULL, Gtk::Dialog * prefDialog = NULL);
~ExecutionEnv (void);
void run (void);
index 7da2a9e2940a6ec9569ef9c43dec49cf41dc1e6d..cef642d5018e03ba37b46b9cdb73522cabfdf040 100644 (file)
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<void> * changeSignal) :
Gtk::Dialog::Dialog(_(name.c_str()), true, true),
_help(help),
_name(name),
_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);
_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();
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();
index 0f385922f65a6009d6c422d04960a94484236f0b..243f92416f0c0d36f72d8443d1abbc0f781ce03c 100644 (file)
sigc::signal<void> _signal_preview;
/** \brief Signal that the user is changing the pinned state */
sigc::signal<void> _signal_pinned;
+ /** \brief Signal that one of the parameters change */
+ sigc::signal<void> * _signal_param_change;
Effect * _effect;
gchar const * help,
Gtk::Widget * controls,
ExecutionEnv * exEnv = NULL,
- Effect * effect = NULL);
+ Effect * effect = NULL,
+ sigc::signal<void> * changeSignal = NULL);
~PrefDialog ();
int run (void);