Skip to content

Commit

Permalink
Fix exception, merge worker stop code
Browse files Browse the repository at this point in the history
Signed-off-by: Taylor Smock <[email protected]>
  • Loading branch information
tsmock committed Oct 10, 2022
1 parent 6d099ba commit 5f8588b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,10 @@ public synchronized void destroy() {
super.destroy();
MainApplication.getMap().filterDialog.getFilterModel().removeTableModelListener(tableModelListener);
List<? extends PointObjectLayer> layers = MainApplication.getLayerManager().getLayersOfType(this.getClass());
if (layers.isEmpty() || (layers.size() == 1 && this.equals(layers.get(0))))
if ((layers.isEmpty() || (layers.size() == 1 && this.equals(layers.get(0)))) &&
MapPaintStyles.getStyles().getStyleSources().contains(mapcss)) {
MapPaintStyles.removeStyle(mapcss);
}
VectorDataSet data = this.getData();
data.removeHighlightUpdateListener(this);
data.removeSelectionListener(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,18 @@
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE, ElementType.METHOD })
@BasicPreferences
@ExtendWith(GuiWorkersStopper.MapillaryNodeDownloader.class)
@ExtendWith(GuiWorkersStopper.MapillarySequenceDownloader.class)
@ExtendWith(GuiWorkersStopper.MapillaryDownloader.class)
@MapillaryLayerAnnotation
public @interface GuiWorkersStopper {
class MapillaryNodeDownloader implements AfterEachCallback {
class MapillaryDownloader implements AfterEachCallback {
@Override
public void afterEach(ExtensionContext context) {
AtomicBoolean done = new AtomicBoolean();
new org.openstreetmap.josm.plugins.mapillary.gui.workers.MapillaryNodesDownloader(nodes -> done.set(true), 1).execute();
Awaitility.await().atMost(Durations.ONE_SECOND).untilTrue(done);
}
}

class MapillarySequenceDownloader implements AfterEachCallback {
@Override
public void afterEach(ExtensionContext context) {
AtomicBoolean done = new AtomicBoolean();
Awaitility.await().atMost(Durations.FIVE_SECONDS).untilTrue(done);
done.set(false);
new org.openstreetmap.josm.plugins.mapillary.gui.workers.MapillarySequenceDownloader("", chunks -> done.set(true)).execute();
Awaitility.await().atMost(Durations.ONE_SECOND).untilTrue(done);
Awaitility.await().atMost(Durations.FIVE_SECONDS).untilTrue(done);
}
}
}

0 comments on commit 5f8588b

Please sign in to comment.