Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java	(revision 5708)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java	(revision 5709)
@@ -410,5 +410,5 @@
             List<Relation> toDelete = new LinkedList<Relation>();
             for (int i : displaylist.getSelectedIndices()) {
-                toDelete.add(model.getRelation(i));
+                toDelete.add(model.getVisibleRelation(i));
             }
             for (Relation r : toDelete) {
@@ -519,5 +519,5 @@
             ArrayList<OsmPrimitive> selection = new ArrayList<OsmPrimitive>(idx.length);
             for (int i: idx) {
-                selection.add(model.getRelation(i));
+                selection.add(model.getVisibleRelation(i));
             }
             if(add) {
@@ -692,5 +692,5 @@
         private ArrayList<Relation> filteredRelations;
         private DefaultListSelectionModel selectionModel;
-        private SearchCompiler.Match filter;
+        //private SearchCompiler.Match filter;
 
         public RelationListModel(DefaultListSelectionModel selectionModel) {
@@ -785,4 +785,7 @@
             int size = relations.size();
             relations.removeAll(removedRelations);
+            if (filteredRelations != null) {
+                filteredRelations.removeAll(removedRelations);
+            }
             if (size != relations.size()) {
                 List<Relation> sel = getSelectedRelations();
@@ -811,5 +814,5 @@
 
         public void setFilter(final SearchCompiler.Match filter) {
-            this.filter = filter;
+            //this.filter = filter;
             this.filteredRelations = new ArrayList<Relation>(Utils.filter(relations, new Predicate<Relation>() {
                 @Override
@@ -827,9 +830,13 @@
             return filteredRelations == null ? relations : filteredRelations;
         }
+        
+        private Relation getVisibleRelation(int index) {
+            if (index < 0 || index >= getVisibleRelations().size()) return null;
+            return getVisibleRelations().get(index);
+        }
 
         @Override
         public Object getElementAt(int index) {
-            if (index < 0 || index >= getVisibleRelations().size()) return null;
-            return getVisibleRelations().get(index);
+            return getVisibleRelation(index);
         }
 
@@ -879,5 +886,5 @@
          * Sets the selected relations.
          *
-         * @return sel the list of selected relations
+         * @param sel the list of selected relations
          */
         public void setSelectedRelations(Collection<Relation> sel) {
@@ -896,4 +903,5 @@
         /**
          * Returns the index of the relation
+         * @param rel The relation to look for
          *
          * @return index of relation (null if it cannot be found)
