Wraps for the code have crash possibility
MODIFY
src/android/plugin/google/maps/PluginGroundOverlay.java
src/android/plugin/google/maps/PluginGroundOverlay.java
@@ -142,6 +142,7 @@ public class PluginGroundOverlay extends MyPlugin implements MyPluginInterface
@Override
public void run() {
Set<String> keySet = pluginMap.objects.keys;
+ if (keySet.size() > 0) {
String[] objectIdArray = keySet.toArray(new String[keySet.size()]);
synchronized (pluginMap.objects) {
@@ -172,10 +173,13 @@ public class PluginGroundOverlay extends MyPlugin implements MyPluginInterface
_clearDone = true;
semaphore.notify();
}
+ }
}
});
+ Set<String> keySet = pluginMap.objects.keys;
+ if (keySet.size() > 0) {
try {
if (!_clearDone) {
semaphore.wait(1000);
@@ -186,6 +190,7 @@ public class PluginGroundOverlay extends MyPlugin implements MyPluginInterface
}
}
}
+ }
/**
* Remove this tile layer

MODIFY
src/android/plugin/google/maps/PluginMap.java
src/android/plugin/google/maps/PluginMap.java
@@ -861,6 +861,7 @@ public class PluginMap extends MyPlugin implements OnMarkerClickListener,
e.printStackTrace();
}
}
+ if (plugins.size() > 0) {
String[] pluginNames = plugins.keySet().toArray(new String[plugins.size()]);
PluginEntry pluginEntry;
for (int i = 0; i < pluginNames.length; i++) {
@@ -874,6 +875,7 @@ public class PluginMap extends MyPlugin implements OnMarkerClickListener,
//((MyPlugin)pluginEntry.plugin).pluginMap = null; // Do not clear at here.
pluginEntry = null;
}
+ }
//Log.d("pluginMap", "--> mapView = " + mapView);
projection = null;
plugins = null;
@@ -2952,7 +2954,7 @@ public class PluginMap extends MyPlugin implements OnMarkerClickListener,
//}
//pluginEntry = plugins.get(pluginName);
//myPlugin = (MyPlugin) pluginEntry.plugin;
-
+ if (objects.size() > 0) {
keys = objects.keys.toArray(new String[objects.size()]);
for (j = 0; j < keys.length; j++) {
key = keys[j];
@@ -2980,6 +2982,7 @@ public class PluginMap extends MyPlugin implements OnMarkerClickListener,
}
}
+ }
//}
} catch (Exception e) {

MODIFY
src/android/plugin/google/maps/PluginMarker.java
src/android/plugin/google/maps/PluginMarker.java
@@ -67,6 +67,7 @@ public class PluginMarker extends MyPlugin implements MyPluginInterface {
@Override
public void run() {
Set<String> keySet = pluginMap.objects.keys;
+ if (keySet.size() > 0) {
String[] objectIdArray = keySet.toArray(new String[keySet.size()]);
for (String objectId : objectIdArray) {
@@ -84,6 +85,7 @@ public class PluginMarker extends MyPlugin implements MyPluginInterface {
}
}
}
+ }
pluginMap.objects.clear();
}

MODIFY
src/android/plugin/google/maps/PluginMarkerCluster.java
src/android/plugin/google/maps/PluginMarkerCluster.java
@@ -61,6 +61,7 @@ public class PluginMarkerCluster extends PluginMarker {
synchronized (pluginMarkers) {
synchronized (deleteMarkers) {
String clusterId_markerId;
+ if (pluginMarkers.size() > 0) {
String[] keys = pluginMarkers.keySet().toArray(new String[pluginMarkers.size()]);
for (int i = 0; i < keys.length; i++) {
clusterId_markerId = keys[i];
@@ -71,6 +72,7 @@ public class PluginMarkerCluster extends PluginMarker {
}
}
}
+ }
//---------------------
// Delete thread
@@ -103,6 +105,7 @@ public class PluginMarkerCluster extends PluginMarker {
Marker marker;
STATUS status;
String cacheKey;
+ if (deleteMarkers.size() > 0) {
String[] targetIDs = deleteMarkers.toArray(new String[deleteMarkers.size()]);
for (int i = targetIDs.length - 1; i > -1; i--) {
@@ -139,7 +142,7 @@ public class PluginMarkerCluster extends PluginMarker {
pluginMarkers.put(markerId, STATUS.DELETED);
}
}
-
+ }
}
}
System.gc();

MODIFY
src/android/plugin/google/maps/PluginPolygon.java
src/android/plugin/google/maps/PluginPolygon.java
@@ -140,6 +140,7 @@ public class PluginPolygon extends MyPlugin implements MyPluginInterface {
@Override
public void run() {
Set<String> keySet = pluginMap.objects.keys;
+ if (keySet.size()) {
String[] objectIdArray = keySet.toArray(new String[keySet.size()]);
for (String objectId : objectIdArray) {
@@ -156,6 +157,7 @@ public class PluginPolygon extends MyPlugin implements MyPluginInterface {
}
}
}
+ }
});
}

Wraps for the code have crash possibility