mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-12-29 00:16:18 +01:00
Fix crash on resource reload
- Backend wasn't properly cleaning up its state - Sneaky error in WorldAttached
This commit is contained in:
parent
6ed59fb877
commit
1da67aaf1a
3 changed files with 5 additions and 3 deletions
|
@ -60,7 +60,9 @@ public class Backend {
|
||||||
|
|
||||||
void clearContexts() {
|
void clearContexts() {
|
||||||
SpecMetaRegistry.clear();
|
SpecMetaRegistry.clear();
|
||||||
|
programSpecRegistry.clear();
|
||||||
contexts.forEach(IShaderContext::delete);
|
contexts.forEach(IShaderContext::delete);
|
||||||
|
contexts.clear();
|
||||||
materialRegistry.clear();
|
materialRegistry.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,8 +102,7 @@ public class InstancedRenderDispatcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void loadAllInWorld(ClientWorld world) {
|
public static void loadAllInWorld(ClientWorld world) {
|
||||||
materialManagers.get(world)
|
materialManagers.replace(world, MaterialManager::delete);
|
||||||
.delete();
|
|
||||||
|
|
||||||
InstanceManager<TileEntity> tiles = tileInstanceManager.replace(world);
|
InstanceManager<TileEntity> tiles = tileInstanceManager.replace(world);
|
||||||
world.loadedTileEntityList.forEach(tiles::add);
|
world.loadedTileEntityList.forEach(tiles::add);
|
||||||
|
|
|
@ -50,7 +50,8 @@ public class WorldAttached<T> {
|
||||||
public T replace(IWorld world, Consumer<T> finalizer) {
|
public T replace(IWorld world, Consumer<T> finalizer) {
|
||||||
T remove = attached.remove(world);
|
T remove = attached.remove(world);
|
||||||
|
|
||||||
finalizer.accept(remove);
|
if (remove != null)
|
||||||
|
finalizer.accept(remove);
|
||||||
|
|
||||||
return get(world);
|
return get(world);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue