Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,23 @@ public void dispose(boolean shuttingDown) {
worldRenderer.dispose();
worldRenderer = null;
}

// The save started above (waitForCompletionOfPreviousSaveAndStartSaving) runs on a
// background scheduler and, as part of serializing entities, sends deactivation events to
// ComponentSystems - the same systems componentSystemManager.shutdown() is about to tear
// down. Blocking on it here, before any system/entity teardown, keeps that in-flight save
// from dispatching events into systems (or entities) that have already been shut down.
// See #704.
if (storageManager != null) {
storageManager.finishSavingAndShutdown();
}

componentSystemManager.shutdown();

context.get(PhysicsEngine.class).dispose();

entityManager.clear();

if (storageManager != null) {
storageManager.finishSavingAndShutdown();
}

ModuleEnvironment oldEnvironment = context.get(ModuleManager.class).getEnvironment();
context.get(ModuleManager.class).loadEnvironment(Collections.<Module>emptySet(), true);
if (!shuttingDown) {
Expand Down
Loading