-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #22233: Deadlock when uploading with incomplete member download e…
…nabled This is caused by custom threading and blocking during the validation process on upload. The validation is run in the EDT, but the custom threading and blocking created a new thread, started it, and then just blocked the EDT. The new thread would then attempt to download data, and during that process it would attempt to show a UI window. This is where the deadlock would occur (the EDT thread is blocked on this new thread). Signed-off-by: Taylor Smock <[email protected]>
- Loading branch information
Showing
5 changed files
with
100 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
...rg/openstreetmap/josm/plugins/pt_assistant/actions/IncompleteMembersDownloadRunnable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// License: GPL. For details, see LICENSE file. | ||
package org.openstreetmap.josm.plugins.pt_assistant.actions; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
import java.util.List; | ||
|
||
import javax.swing.SwingUtilities; | ||
|
||
import org.openstreetmap.josm.data.osm.Node; | ||
import org.openstreetmap.josm.data.osm.OsmPrimitive; | ||
import org.openstreetmap.josm.data.osm.OsmPrimitiveType; | ||
import org.openstreetmap.josm.data.osm.PrimitiveId; | ||
import org.openstreetmap.josm.data.osm.Relation; | ||
import org.openstreetmap.josm.gui.MainApplication; | ||
import org.openstreetmap.josm.gui.io.DownloadPrimitivesWithReferrersTask; | ||
import org.openstreetmap.josm.plugins.pt_assistant.utils.RouteUtils; | ||
import org.openstreetmap.josm.plugins.pt_assistant.utils.StopUtils; | ||
|
||
/** | ||
* Runnable that downloads incomplete relation members while pausing the rest of testing | ||
* @author darya | ||
* | ||
*/ | ||
public class IncompleteMembersDownloadRunnable implements Runnable { | ||
|
||
/** | ||
* Default constructor | ||
*/ | ||
public IncompleteMembersDownloadRunnable() { | ||
super(); | ||
} | ||
|
||
@Override | ||
public void run() { | ||
|
||
synchronized (this) { | ||
|
||
ArrayList<PrimitiveId> list = new ArrayList<>(); | ||
|
||
// if there are selected routes, try adding them first: | ||
for (Relation currentSelectedRelation : MainApplication.getLayerManager().getEditDataSet().getSelectedRelations()) { | ||
if (RouteUtils.isVersionTwoPTRoute(currentSelectedRelation)) { | ||
list.add(currentSelectedRelation); | ||
} | ||
} | ||
|
||
if (list.isEmpty()) { | ||
// add all route relations that are of public_transport | ||
// version 2: | ||
Collection<Relation> allRelations = MainApplication.getLayerManager().getEditDataSet().getRelations(); | ||
for (Relation currentRelation : allRelations) { | ||
if (RouteUtils.isVersionTwoPTRoute(currentRelation)) { | ||
list.add(currentRelation); | ||
} | ||
} | ||
} | ||
|
||
// add all stop_positions: | ||
Collection<Node> allNodes = MainApplication.getLayerManager().getEditDataSet().getNodes(); | ||
for (Node currentNode : allNodes) { | ||
if (StopUtils.isStopPosition(currentNode)) { | ||
List<OsmPrimitive> referrers = currentNode.getReferrers(); | ||
boolean parentWayExists = false; | ||
for (OsmPrimitive referrer : referrers) { | ||
if (referrer.getType() == OsmPrimitiveType.WAY) { | ||
parentWayExists = true; | ||
break; | ||
} | ||
} | ||
if (!parentWayExists) { | ||
list.add(currentNode); | ||
|
||
} | ||
|
||
} | ||
} | ||
|
||
DownloadPrimitivesWithReferrersTask task = new DownloadPrimitivesWithReferrersTask(false, list, false, true, | ||
null, null); | ||
task.run(); | ||
} | ||
} | ||
} |
95 changes: 0 additions & 95 deletions
95
.../org/openstreetmap/josm/plugins/pt_assistant/actions/IncompleteMembersDownloadThread.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters