This commit is contained in:
mcrcortex
2024-05-07 10:08:56 +10:00
parent 01d5436e2d
commit 05e8145fa6
2 changed files with 7 additions and 1 deletions

View File

@@ -43,6 +43,10 @@ public class ContextSelectionSystem {
config.storageConfig = compression;
DEFAULT_STORAGE_CONFIG = Serialization.GSON.toJson(config);
if (Serialization.GSON.fromJson(DEFAULT_STORAGE_CONFIG, WorldConfig.class) == null) {
throw new IllegalStateException();
}
}
public static class Selection {

View File

@@ -52,7 +52,9 @@ public class MemoryStorageBackend extends StorageBackend {
public void setSectionData(long key, ByteBuffer data) {
var map = this.getMap(key);
synchronized (map) {
var old = map.put(key, data);
var cpy = MemoryUtil.memAlloc(data.remaining());
MemoryUtil.memCopy(data, cpy);
var old = map.put(key, cpy);
if (old != null) {
MemoryUtil.memFree(old);
}