mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-09 11:55:52 -04:00
fix: ConcurrentModificationException
This commit is contained in:
parent
02cb2a3fb1
commit
43de254a98
@ -100,12 +100,7 @@ public abstract class VersionList<T extends RemoteVersion> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected Collection<T> getVersionsImpl(String gameVersion) {
|
protected Collection<T> getVersionsImpl(String gameVersion) {
|
||||||
lock.readLock().lock();
|
return versions.get(gameVersion);
|
||||||
try {
|
|
||||||
return versions.get(gameVersion);
|
|
||||||
} finally {
|
|
||||||
lock.readLock().unlock();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -115,7 +110,12 @@ public abstract class VersionList<T extends RemoteVersion> {
|
|||||||
* @return the collection of specific remote versions
|
* @return the collection of specific remote versions
|
||||||
*/
|
*/
|
||||||
public final Collection<T> getVersions(String gameVersion) {
|
public final Collection<T> getVersions(String gameVersion) {
|
||||||
return Collections.unmodifiableCollection(getVersionsImpl(gameVersion));
|
lock.readLock().lock();
|
||||||
|
try {
|
||||||
|
return Collections.unmodifiableCollection(new ArrayList<>(getVersionsImpl(gameVersion)));
|
||||||
|
} finally {
|
||||||
|
lock.readLock().unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,12 +45,7 @@ public final class GameVersionList extends VersionList<GameRemoteVersion> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Collection<GameRemoteVersion> getVersionsImpl(String gameVersion) {
|
protected Collection<GameRemoteVersion> getVersionsImpl(String gameVersion) {
|
||||||
lock.readLock().lock();
|
return versions.values();
|
||||||
try {
|
|
||||||
return versions.values();
|
|
||||||
} finally {
|
|
||||||
lock.readLock().unlock();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user