Code

Fixed a crash on removing a filter primitive in the filter effects dialog.
authornicholasbishop <nicholasbishop@users.sourceforge.net>
Thu, 17 Jan 2008 16:41:33 +0000 (16:41 +0000)
committernicholasbishop <nicholasbishop@users.sourceforge.net>
Thu, 17 Jan 2008 16:41:33 +0000 (16:41 +0000)
src/ui/dialog/filter-effects-dialog.cpp
src/ui/dialog/filter-effects-dialog.h

index dcd3cd8cf42200c8ebaaec6ee4dca3c10c1e3ca6..06275bf1be685826d84c621264687d14d231d472 100644 (file)
@@ -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();
index 49343c0ce78504804b72c84e9e602299d843de9a..34f282fbbcf8899e5eda31451c5fdec22d3d5887 100644 (file)
@@ -165,6 +165,7 @@ private:
 
         SPFilterPrimitive* get_selected();
         void select(SPFilterPrimitive *prim);
+        void remove_selected();
 
         int primitive_count() const;
     protected: