From: nicholasbishop Date: Sun, 12 Aug 2007 08:30:52 +0000 (+0000) Subject: Filter effects dialog: X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3558342104a0adb7338f5180131eb7096bf9dbcf;p=inkscape.git Filter effects dialog: * Fixed bad use of tree iterators; caused crashes when drag/dropping filter primitives --- diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index fe2e8f1c6..c871d447e 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -1657,7 +1657,7 @@ void FilterEffectsDialog::PrimitiveList::sanitize_connections(const Gtk::TreeIte } // Reorder the filter primitives to match the list order -void FilterEffectsDialog::PrimitiveList::on_drag_end(const Glib::RefPtr&) +void FilterEffectsDialog::PrimitiveList::on_drag_end(const Glib::RefPtr& dc) { SPFilter* filter = _dialog._filter_modifier.get_selected_filter(); int ndx = 0; @@ -1665,12 +1665,19 @@ void FilterEffectsDialog::PrimitiveList::on_drag_end(const Glib::RefPtrchildren().begin(); iter != _model->children().end(); ++iter, ++ndx) { SPFilterPrimitive* prim = (*iter)[_columns.primitive]; - if(prim) { + if(prim && prim == _drag_prim) { SP_OBJECT_REPR(prim)->setPosition(ndx); - if(_drag_prim == prim) { - sanitize_connections(iter); - get_selection()->select(iter); - } + break; + } + } + + for(Gtk::TreeModel::iterator iter = _model->children().begin(); + iter != _model->children().end(); ++iter, ++ndx) { + SPFilterPrimitive* prim = (*iter)[_columns.primitive]; + if(prim && prim == _drag_prim) { + sanitize_connections(iter); + get_selection()->select(iter); + break; } }