2009/5/29 Jérôme Laheurte <[email protected]>: > > When the session terminates (log off, reboot, shutdown) while Task > Coach is running, the app exits without the frame having been notified > that it's closing. This can obviously lead to data loss (think of a > laptop automatically shutting down because of low power) but it has > also other consequences: the last opened file is not remembered, the > task file is still locked, probably some others. > > There seems to be a notification system (EVT_QUERY_END_SESSION) that > we use precisely to avoid blocking the shutdown process with a dialog > box, so I guess the potential data loss has been considered a lesser > evil. Unfortunately, this mechanism works only under Windows (I didn't > try MacOS but it sure doesn't work under Linux with the latest wx).
At least on Windows, app's get send the EVT_QUERY_END_SESSION event to give them a chance to properly close files and the like. However, I've never fully understood how this works. In TC we bind the EVT_QUERY_END_SESSION event, but the handler does nothing and the comment says: "This makes sure we don't block shutdown on Windows"...? Anyway, TC does behave as it should far as I can tell: just this afternoon as I was on my way home I shut down my work laptop and the shutdown process was temporarily blocked by Task Coach, asking me if I wanted to save my changes or not. > 1) Handle the case under Win32 by releasing the lock when the system > shuts down Which should happen if mainwindow.quit() is called, which is called by mainwindow.onClose() which is called when the app is forcibly quit, so this should already work. > 2) Make the "don't prompt if there are modifications when closing" an > option, off by default, because I think most people are in front of > their computer when they shut it down and don't want to lose data I'd rather not have an additional option for this. We have (too?) many options already. > 3) Somehow work around the wx limitation in order to do 1) on Linux > and MacOS too. This will probably involve platform-specific code using > ctypes and maybe pyobjc, I'll try to dig this this week-end. It would be weird if we're the first ones being bitten by this, I'll try to do some Google magic. Cheers, Frank
