Index: trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java	(revision 4616)
+++ trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java	(revision 4617)
@@ -125,4 +125,12 @@
     private long mouseDownTime = 0;
     /**
+     * The pressed button of the user mouse down event.
+     */
+    private int mouseDownButton = 0;
+    /**
+     * The time of the user mouse down event.
+     */
+    private long mouseReleaseTime = 0;
+    /**
      * The time which needs to pass between click and release before something
      * counts as a move, in milliseconds
@@ -336,4 +344,10 @@
         if (!mv.isActiveLayerVisible())
             return;
+        
+        // Swing sends random mouseDragged events when closing dialogs by double-clicking their top-left icon on Windows
+        // Ignore such false events to prevent issues like #7078
+        if (mouseDownButton == MouseEvent.BUTTON1 && mouseReleaseTime > mouseDownTime) {
+            return;
+        }
 
         cancelDrawMode = true;
@@ -648,5 +662,5 @@
     public void mousePressed(MouseEvent e) {
         // return early
-        if (!mv.isActiveLayerVisible() || !(Boolean) this.getValue("active") || e.getButton() != MouseEvent.BUTTON1)
+        if (!mv.isActiveLayerVisible() || !(Boolean) this.getValue("active") || (mouseDownButton = e.getButton()) != MouseEvent.BUTTON1)
             return;
 
@@ -705,4 +719,5 @@
 
         startingDraggingPos = null;
+        mouseReleaseTime = System.currentTimeMillis();
 
         if (mode == Mode.select) {
