improve autosave reliability
Closed this issue · 1 comments
KrabCode commented
clicking the square STOP button in PDE does not save the json gui state to disk
maybe using the dispose() function as described here would be more reliable?
KrabCode commented
it does not improve the behavior nor does it worsen it, but the code looks much better now, so let's keep the dispose() approach
this new implementation looks a lot easier to read:
public static void registerAutosaveOnExitHandler() {
GlobalReferences.app.registerMethod("dispose", singletonInstance);
}
public void dispose(){
createNewAutosave();
}
than this:
public static void registerExitHandler() {
Runtime.getRuntime().addShutdownHook(new Thread(JsonSaveStore::createNewAutosave));
}