Fix disabling map

This commit is contained in:
Victor Shcherb 2015-08-04 00:25:11 +02:00
parent 81d026aa25
commit aca1fa0674

View file

@ -143,14 +143,14 @@ public class MapRenderRepositories {
return prevBmpLocation; return prevBmpLocation;
} }
public void closeConnection(String file) { public synchronized void closeConnection(String file) {
LinkedHashMap<String, BinaryMapIndexReader> cpfiles = new LinkedHashMap<String, BinaryMapIndexReader>(files); LinkedHashMap<String, BinaryMapIndexReader> cpfiles = new LinkedHashMap<String, BinaryMapIndexReader>(files);
BinaryMapIndexReader bmir = cpfiles.remove(file); BinaryMapIndexReader bmir = cpfiles.remove(file);
files = cpfiles; files = cpfiles;
if (nativeFiles.contains(file)) { if (nativeFiles.contains(file)) {
NativeOsmandLibrary lib = NativeOsmandLibrary.getLoadedLibrary(); NativeOsmandLibrary lib = NativeOsmandLibrary.getLoadedLibrary();
if (lib != null) { if (lib != null) {
lib.closeMapFile(file); lib.closeMapFile(bmir != null ? bmir.getFile().getAbsolutePath() : file);
nativeFiles.remove(file); nativeFiles.remove(file);
} }
} }