From 56ec4d9cbe391c84f361faa851d796f61cc5fbc8 Mon Sep 17 00:00:00 2001 From: nicholasbishop Date: Thu, 17 Jan 2008 16:41:33 +0000 Subject: [PATCH] Fixed a crash on removing a filter primitive in the filter effects dialog. --- src/ui/dialog/filter-effects-dialog.cpp | 30 ++++++++++++------------- src/ui/dialog/filter-effects-dialog.h | 1 + 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index dcd3cd8cf..06275bf1b 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -1331,7 +1331,21 @@ void FilterEffectsDialog::PrimitiveList::select(SPFilterPrimitive* prim) } } +void FilterEffectsDialog::PrimitiveList::remove_selected() +{ + SPFilterPrimitive* prim = get_selected(); + + if(prim) { + _observer->set(0); + + sp_repr_unparent(prim->repr); + sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_FILTER_EFFECTS, + _("Remove filter primitive")); + + update(); + } +} bool FilterEffectsDialog::PrimitiveList::on_expose_signal(GdkEventExpose* e) { @@ -1889,7 +1903,7 @@ FilterEffectsDialog::FilterEffectsDialog() ((Gtk::Label*)fr_settings->get_label_widget())->set_use_markup(); _add_primitive.signal_clicked().connect(sigc::mem_fun(*this, &FilterEffectsDialog::add_primitive)); _primitive_list.set_menu(create_popup_menu(*this, sigc::mem_fun(*this, &FilterEffectsDialog::duplicate_primitive), - sigc::mem_fun(*this, &FilterEffectsDialog::remove_primitive))); + sigc::mem_fun(_primitive_list, &PrimitiveList::remove_selected))); show_all_children(); init_settings_widgets(); @@ -2010,20 +2024,6 @@ void FilterEffectsDialog::add_primitive() } } -void FilterEffectsDialog::remove_primitive() -{ - SPFilterPrimitive* prim = _primitive_list.get_selected(); - - if(prim) { - sp_repr_unparent(prim->repr); - - sp_document_done(sp_desktop_document(getDesktop()), SP_VERB_DIALOG_FILTER_EFFECTS, - _("Remove filter primitive")); - - _primitive_list.update(); - } -} - void FilterEffectsDialog::duplicate_primitive() { SPFilter* filter = _filter_modifier.get_selected_filter(); diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h index 49343c0ce..34f282fbb 100644 --- a/src/ui/dialog/filter-effects-dialog.h +++ b/src/ui/dialog/filter-effects-dialog.h @@ -165,6 +165,7 @@ private: SPFilterPrimitive* get_selected(); void select(SPFilterPrimitive *prim); + void remove_selected(); int primitive_count() const; protected: -- 2.30.2