[platform] incorrect fix reverted

This commit is contained in:
Roman Shevchenko
2016-05-12 16:20:57 +02:00
parent f4ea28d8bf
commit 0c17998335
@@ -172,6 +172,10 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
myDoNotSave = isUnitTestMode || isHeadless;
if (myTestModeFlag) {
registerShutdownHook();
}
if (!isUnitTestMode && !isHeadless) {
Disposer.register(this, Disposer.newDisposable(), "ui");
@@ -218,6 +222,26 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
myLock = new ReadMostlyRWLock(edt);
}
private void registerShutdownHook() {
ShutDownTracker.getInstance().registerShutdownTask(() -> {
if (isDisposed() || myDisposeInProgress) {
return;
}
ShutDownTracker.invokeAndWait(isUnitTestMode(), true, () -> {
if (ApplicationManager.getApplication() != this) return;
try {
myDisposeInProgress = true;
saveAll();
}
finally {
if (!disposeSelf(true)) {
myDisposeInProgress = false;
}
}
});
});
}
private boolean disposeSelf(final boolean checkCanCloseProject) {
final ProjectManagerImpl manager = (ProjectManagerImpl)ProjectManagerEx.getInstanceEx();
if (manager != null) {