Index: trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java	(revision 19719)
+++ trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java	(revision 19720)
@@ -13,4 +13,7 @@
 import java.awt.event.KeyEvent;
 import java.awt.event.MouseEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowFocusListener;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -147,4 +150,12 @@
     private final ParallelWayLayer temporaryLayer = new ParallelWayLayer();
 
+    /** #25012: a drag cannot continue once JOSM loses the focus, as the mouse release may go to another window */
+    private final WindowFocusListener focusListener = new WindowAdapter() {
+        @Override
+        public void windowLostFocus(WindowEvent e) {
+            cancelDrag();
+        }
+    };
+
     /**
      * Constructs a new {@code ParallelWayAction}.
@@ -176,4 +187,7 @@
         // Needed to update the mouse cursor if modifiers are changed when the mouse is motionless
         MainApplication.getMap().keyDetector.addModifierExListener(this);
+        if (MainApplication.getMainFrame() != null) {
+            MainApplication.getMainFrame().addWindowFocusListener(focusListener);
+        }
         sourceWays = new LinkedHashSet<>(getLayerManager().getEditDataSet().getSelectedWays());
         for (Way w : sourceWays) {
@@ -191,4 +205,7 @@
         map.statusLine.setDist(-1);
         map.keyDetector.removeModifierExListener(this);
+        if (MainApplication.getMainFrame() != null) {
+            MainApplication.getMainFrame().removeWindowFocusListener(focusListener);
+        }
         removeWayHighlighting(sourceWays);
         pWays = null;
@@ -282,4 +299,7 @@
             return;
 
+        // #25012: the release ending the previous drag never arrived, drop that drag and start afresh
+        cancelDrag();
+
         if (!sanityCheck())
             return;
@@ -306,5 +326,6 @@
         updateModifiersState(e.getModifiersEx());
         // Other buttons are off limit, but we still get events.
-        if (e.getButton() != MouseEvent.BUTTON1)
+        // Ignore the release of a press that was not accepted or whose drag was cancelled.
+        if (e.getButton() != MouseEvent.BUTTON1 || !mouseIsDown)
             return;
 
@@ -516,4 +537,19 @@
     }
 
+    /**
+     * Cancels the drag in progress, if any. Nothing has been changed yet, since the parallel ways are only created
+     * when the mouse is released.
+     */
+    private void cancelDrag() {
+        if (mode == Mode.DRAGGING) {
+            pWays = null;
+            helperSegment = null;
+            setMode(Mode.NORMAL);
+            MainApplication.getMap().statusLine.setDist(-1);
+            temporaryLayer.invalidate();
+        }
+        resetMouseTrackingState();
+    }
+
     private void resetMouseTrackingState() {
         mouseIsDown = false;
