Index: trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/DataSet.java	(revision 2451)
+++ trunk/src/org/openstreetmap/josm/data/osm/DataSet.java	(revision 2452)
@@ -233,4 +233,5 @@
         allPrimitives.remove(primitive);
         primitive.setDataset(null);
+        errors.remove(primitive);
         firePrimitivesRemoved(Collections.singletonList(primitive));
     }
@@ -871,3 +872,21 @@
         allPrimitives.clear();
     }
+
+
+    // TODO Should be part of validator
+    // This used to be OsmPrimitive.errors. I don't really like that such information is kept here,
+    // but at least it's not such memory waste as having it in (every) OsmPrimitive
+    private Map<OsmPrimitive, List<String>> errors = new HashMap<OsmPrimitive, List<String>>();
+
+    void setErrors(OsmPrimitive primitive, List<String> errors) {
+        if (errors != null && !errors.isEmpty()) {
+            this.errors.put(primitive, errors);
+        } else {
+            this.errors.remove(primitive);
+        }
+    }
+
+    public List<String> getErrors(OsmPrimitive primitive) {
+        return errors.get(primitive);
+    }
 }
Index: trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 2451)
+++ trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 2452)
@@ -97,19 +97,29 @@
     /* mappaint data */
     public ElemStyle mappaintStyle = null;
-    public Integer mappaintVisibleCode = 0;
     public Integer mappaintDrawnCode = 0;
-    public Collection<String> errors;
-
-    public void putError(String text, Boolean isError)
+
+    public void putError(String text, boolean isError)
     {
-        if(errors == null) {
+        checkDataset();
+        List<String> errors = dataSet.getErrors(this);
+        if (errors == null) {
             errors = new ArrayList<String>();
         }
         String s = isError ? tr("Error: {0}", text) : tr("Warning: {0}", text);
         errors.add(s);
+        dataSet.setErrors(this, errors);
     }
     public void clearErrors()
     {
-        errors = null;
+        if (dataSet != null) {
+            dataSet.setErrors(this, null);
+        }
+    }
+
+    public List<String> getErrors() {
+        if (dataSet == null)
+            return null;
+        else
+            return dataSet.getErrors(this);
     }
     /* This should not be called from outside. Fixing the UI to add relevant
@@ -118,5 +128,4 @@
     protected void clearCached()
     {
-        mappaintVisibleCode = 0;
         mappaintDrawnCode = 0;
         mappaintStyle = null;
@@ -798,5 +807,4 @@
         user= osm.user;
         clearCached();
-        clearErrors();
     }
 
Index: trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java	(revision 2451)
+++ trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java	(revision 2452)
@@ -148,9 +148,5 @@
                 (n.getEastNorth().east()  < minEN.east() ) ||
                 (n.getEastNorth().north() < minEN.north()))
-        {
-            n.mappaintVisibleCode = viewid;
             return;
-        }
-        n.mappaintVisibleCode = 0;
 
         IconElemStyle nodeStyle = (IconElemStyle)getPrimitiveStyle(n);
@@ -186,8 +182,5 @@
     public void drawWay(Way w, int fillAreas) {
         if(w.getNodesCount() < 2)
-        {
-            w.mappaintVisibleCode = viewid;
             return;
-        }
 
         /* check, if the way is visible at all */
@@ -217,18 +210,11 @@
                 (maxx < minEN.east()) ||
                 (maxy < minEN.north()))
-        {
-            w.mappaintVisibleCode = viewid;
             return;
-        }
 
         ElemStyle wayStyle = getPrimitiveStyle(w);
 
         if(!isZoomOk(wayStyle))
-        {
-            w.mappaintVisibleCode = viewid;
             return;
-        }
-
-        w.mappaintVisibleCode = 0;
+
         if(fillAreas > dist) {
             w.clearErrors();
@@ -540,5 +526,4 @@
     public void visit(Relation r) {};
     public void paintUnselectedRelation(Relation r) {
-        r.mappaintVisibleCode = 0;
 
         if (drawMultipolygon && "multipolygon".equals(r.get("type")))
@@ -1046,15 +1031,6 @@
                 }
             }
-            if(!visible) /* nothing visible, so disable relation and all its ways */
-            {
-                r.mappaintVisibleCode = viewid;
-                for (Way wInner : inner) {
-                    wInner.mappaintVisibleCode = viewid;
-                }
-                for (Way wOuter : outer) {
-                    wOuter.mappaintVisibleCode = viewid;
-                }
+            if(!visible)
                 return drawn;
-            }
             for (Way wInner : inner)
             {
@@ -1510,5 +1486,5 @@
             //    profilerN = 0;
             for (final Relation osm: data.getRelations()) {
-                if (drawable(osm) && osm.mappaintVisibleCode != viewid) {
+                if (drawable(osm)) {
                     paintUnselectedRelation(osm);
                     //            profilerN++;
@@ -1525,6 +1501,5 @@
             //    profilerN = 0;
             for (final Way osm : selectedLast(data, data.searchWays(bbox))) {
-                if (drawable(osm)
-                        && osm.mappaintVisibleCode != viewid && osm.mappaintDrawnCode != paintid) {
+                if (drawable(osm) && osm.mappaintDrawnCode != paintid) {
                     if (isPrimitiveArea(osm) && osm.mappaintDrawnAreaCode != paintid) {
                         drawWay(osm, fillAreas);
@@ -1560,6 +1535,5 @@
             //    profilerN = 0;
             for (final Way way: data.getWays()) {
-                if (drawable(way) && !data.isSelected(way)
-                        && way.mappaintVisibleCode != viewid) {
+                if (drawable(way) && !data.isSelected(way)) {
                     drawWay(way, 0);
                     //            profilerN++;
@@ -1579,5 +1553,5 @@
         for (final OsmPrimitive osm : data.getSelected()) {
             if (!osm.incomplete && !osm.isDeleted() && !(osm instanceof Node)
-                    && osm.mappaintVisibleCode != viewid && osm.mappaintDrawnCode != paintid
+                    && osm.mappaintDrawnCode != paintid
             ) {
                 osm.visit(new AbstractVisitor() {
@@ -1594,5 +1568,4 @@
                         //if(profilerOmitDraw)
                         //    return;
-                        r.mappaintVisibleCode = 0;
                         for (RelationMember m : r.getMembers()) {
                             if (m.isNode() && drawable(m.getMember())) {
@@ -1619,5 +1592,5 @@
         for (final Node osm: data.searchNodes(bbox)) {
             if (!osm.incomplete && !osm.isDeleted() && (data.isSelected(osm) || !osm.isFiltered())
-                    && osm.mappaintVisibleCode != viewid && osm.mappaintDrawnCode != paintid)
+                    && osm.mappaintDrawnCode != paintid)
             {
                 drawNode(osm);
@@ -1638,6 +1611,5 @@
             currentColor = nodeColor;
             for (final OsmPrimitive osm: data.searchWays(bbox)) {
-                if (osm.isUsable() && !osm.isFiltered()
-                        && osm.mappaintVisibleCode != viewid )
+                if (osm.isUsable() && !osm.isFiltered())
                 {
                     /* TODO: move this into the SimplePaint code? */
Index: trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java	(revision 2451)
+++ trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java	(revision 2452)
@@ -138,5 +138,5 @@
             String nodes = trn("{0} node", "{0} nodes", nodesNo, nodesNo);
             name += (name.length() > 0) ? " ("+nodes+")" : nodes;
-            if(way.errors != null) {
+            if(way.getErrors() != null) {
                 name = "*"+name;
             }
@@ -189,5 +189,5 @@
             int mbno = relation.getMembersCount();
             name += trn("{0} member", "{0} members", mbno, mbno) + ")";
-            if(relation.errors != null) {
+            if(relation.getErrors() != null) {
                 name = "*"+name;
             }
