Always discard database undo history after each platform startup.
[simantics/platform.git] / bundles / org.simantics / src / org / simantics / SimanticsPlatform.java
index 54b96054719e993986a7ab6ad2e938b67fc0e430..211b286a9401e290c0f5819bf9c5d76c035f9a5b 100644 (file)
@@ -65,7 +65,6 @@ import org.simantics.db.VirtualGraph;
 import org.simantics.db.WriteGraph;
 import org.simantics.db.common.request.ObjectsWithType;
 import org.simantics.db.common.request.Queries;
-import org.simantics.db.common.request.WriteRequest;
 import org.simantics.db.common.request.WriteResultRequest;
 import org.simantics.db.common.utils.Transaction;
 import org.simantics.db.exception.ClusterSetExistException;
@@ -914,6 +913,12 @@ public class SimanticsPlatform implements LifecycleListener {
         // #7650: improve shutdown robustness in all applications that use the platform
         Runtime.getRuntime().addShutdownHook(shutdownHook);
 
+        // Discard database session undo history at this point to prevent
+        // the user from undoing any initialization operations performed
+        // by the platform startup.
+        SimanticsPlatform.INSTANCE.discardSessionUndoHistory();
+        TimeLogger.log("Discarded session undo history");
+
         return sessionContext;
 
     }