From: Keith Packard Date: Sun, 15 Jun 2014 01:51:25 +0000 (-0700) Subject: altosuilib: Serialize access to async tile notify function in preload X-Git-Tag: 1.4~16 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=5392ee3c5328f8384ed30a2d147e4be96075e064 altosuilib: Serialize access to async tile notify function in preload This ensures that we see each tile getting downloaded and don't mis-count, which would result in wedging the process Signed-off-by: Keith Packard --- diff --git a/altosuilib/AltosUIMapPreload.java b/altosuilib/AltosUIMapPreload.java index 3bdba39e..c91b06b8 100644 --- a/altosuilib/AltosUIMapPreload.java +++ b/altosuilib/AltosUIMapPreload.java @@ -327,7 +327,7 @@ public class AltosUIMapPreload extends AltosUIFrame implements ActionListener, I /* AltosUIMapTileListener methods */ - public void notify_tile(AltosUIMapTile tile, int status) { + public synchronized void notify_tile(AltosUIMapTile tile, int status) { if (status == AltosUIMapStore.loading) return; diff --git a/altosuilib/AltosUIMapView.java b/altosuilib/AltosUIMapView.java index 4df178e2..a14fde65 100644 --- a/altosuilib/AltosUIMapView.java +++ b/altosuilib/AltosUIMapView.java @@ -387,7 +387,7 @@ public class AltosUIMapView extends Component implements MouseMotionListener, Mo } /* AltosUIMapTileListener methods */ - public void notify_tile(AltosUIMapTile tile, int status) { + public synchronized void notify_tile(AltosUIMapTile tile, int status) { for (Point point : tiles.keySet()) { if (tile == tiles.get(point)) { Point screen = transform.screen(point); @@ -399,7 +399,7 @@ public class AltosUIMapView extends Component implements MouseMotionListener, Mo public AltosUIMapCache cache() { return cache; } /* AltosUIMapStoreListener methods */ - public void notify_store(AltosUIMapStore store, int status) { + public synchronized void notify_store(AltosUIMapStore store, int status) { if (load_listener != null) { for (AltosUIMapTile tile : tiles.values()) if (store.equals(tile.store))