Index: /trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java	(revision 5499)
+++ /trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java	(revision 5500)
@@ -4,6 +4,9 @@
 import static org.openstreetmap.josm.tools.I18n.marktr;
 
+import java.awt.Color;
 import java.awt.Cursor;
+import java.awt.Graphics;
 import java.awt.Point;
+import java.awt.Polygon;
 import java.awt.Rectangle;
 import java.awt.geom.AffineTransform;
@@ -108,4 +111,8 @@
     protected EastNorth center = calculateDefaultCenter();
 
+    private static final Object paintRequestLock = new Object();
+    private Rectangle paintRect = null;
+    private Polygon paintPoly = null;
+    
     public NavigatableComponent() {
         setLayout(null);
@@ -1266,3 +1273,75 @@
         Cursors = c;
     }
+    
+    @Override
+    public void paint(Graphics g) {
+        synchronized (paintRequestLock) {
+            if (paintRect != null) {
+                Graphics g2 = g.create();
+                g2.setColor(Color.BLACK);
+                g2.setXORMode(Color.WHITE);
+                g2.drawRect(paintRect.x, paintRect.y, paintRect.width, paintRect.height);
+            }
+            if (paintPoly != null) {
+                Graphics g2 = g.create();
+                g2.setColor(Color.WHITE);
+                g2.drawPolyline(paintPoly.xpoints, paintPoly.ypoints, paintPoly.npoints);
+            }
+        }
+        super.paint(g);
+    }
+
+    /**
+     * Requests to paint the given {@code Rectangle}.
+     * @param r The Rectangle to draw
+     * @see #requestClearRect
+     * @since 5500
+     */
+    public void requestPaintRect(Rectangle r) {
+        if (r != null) {
+            synchronized (paintRequestLock) {
+                paintRect = r;
+            }
+            repaint();
+        }
+    }
+    
+    /**
+     * Requests to paint the given {@code Polygon} as a polyline (unclosed polygon).
+     * @param p The Polygon to draw
+     * @see #requestClearPoly
+     * @since 5500
+     */
+    public void requestPaintPoly(Polygon p) {
+        if (p != null) {
+            synchronized (paintRequestLock) {
+                paintPoly = p;
+            }
+            repaint();
+        }
+    }
+    
+    /**
+     * Requests to clear the rectangled previously drawn.
+     * @see #requestPaintRect
+     * @since 5500
+     */
+    public void requestClearRect() {
+        synchronized (paintRequestLock) {
+            paintRect = null;
+        }
+        repaint();
+    }
+
+    /**
+     * Requests to clear the polyline previously drawn.
+     * @see #requestPaintPoly
+     * @since 5500
+     */
+    public void requestClearPoly() {
+        synchronized (paintRequestLock) {
+            paintPoly = null;
+        }
+        repaint();
+    }
 }
Index: /trunk/src/org/openstreetmap/josm/gui/SelectionManager.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/SelectionManager.java	(revision 5499)
+++ /trunk/src/org/openstreetmap/josm/gui/SelectionManager.java	(revision 5500)
@@ -2,7 +2,5 @@
 package org.openstreetmap.josm.gui;
 
-import java.awt.Color;
 import java.awt.Component;
-import java.awt.Graphics;
 import java.awt.Point;
 import java.awt.Polygon;
@@ -57,7 +55,5 @@
          * Called, when the left mouse button was released.
          * @param r The rectangle that is currently the selection.
-         * @param alt Whether the alt key was pressed
-         * @param shift Whether the shift key was pressed
-         * @param ctrl Whether the ctrl key was pressed
+         * @param e The mouse event.
          * @see InputEvent#getModifiersEx()
          */
@@ -119,4 +115,5 @@
      * Register itself at the given event source.
      * @param eventSource The emitter of the mouse events.
+     * @param lassoMode {@code true} to enable lasso mode, {@code false} to disable it.
      */
     public void register(NavigatableComponent eventSource, boolean lassoMode) {
@@ -199,9 +196,10 @@
         Rectangle r;
         if (!lassoMode) {
-            paintRect();
+            nc.requestClearRect();
             r = getSelectionRectangle();
 
             lasso = rectToPolygon(r);
         } else {
+            nc.requestClearPoly();
             lasso.addPoint(mousePos.x, mousePos.y);
             r = lasso.getBounds();
@@ -216,31 +214,18 @@
 
     /**
-     * Draw a selection rectangle on screen. If already a rectangle is drawn,
-     * it is removed instead.
+     * Draws a selection rectangle on screen.
      */
     private void paintRect() {
         if (mousePos == null || mousePosStart == null || mousePos == mousePosStart)
             return;
-        Graphics g = nc.getGraphics();
-        g.setColor(Color.BLACK);
-        g.setXORMode(Color.WHITE);
-
-        Rectangle r = getSelectionRectangle();
-        g.drawRect(r.x,r.y,r.width,r.height);
-    }
-
+        nc.requestPaintRect(getSelectionRectangle());
+    }
+    
     private void paintLasso() {
         if (mousePos == null || mousePosStart == null || mousePos == mousePosStart) {
             return;
         }
-
-        Graphics g = nc.getGraphics();
-        g.setColor(Color.WHITE);
-
-        int lastPosX = lasso.xpoints[lasso.npoints - 1];
-        int lastPosY = lasso.ypoints[lasso.npoints - 1];
-        g.drawLine(lastPosX, lastPosY, mousePos.x, mousePos.y);
-
         lasso.addPoint(mousePos.x, mousePos.y);
+        nc.requestPaintPoly(lasso);
     }
 
@@ -302,4 +287,5 @@
      * @param alt Whether the alt key was pressed, which means select all
      * objects that are touched, instead those which are completely covered.
+     * @return The collection of selected objects.
      */
     public Collection<OsmPrimitive> getSelectedObjects(boolean alt) {
@@ -368,4 +354,8 @@
     }
 
+    /**
+     * Enables or disables the lasso mode.
+     * @param lassoMode {@code true} to enable lasso mode, {@code false} to disable it.
+     */
     public void setLassoMode(boolean lassoMode) {
         this.lassoMode = lassoMode;
