Stamp received today a little update in order to fix a nasty bug related to the way it was blocking the automated logout process on macOS.
As probably you know, this was due to the fact that Stamp opens a final window showing the amount of characters you don’t have to type thanks to his functionality (and that offers you to buy the license in case you are running it in trial mode).
Well, that isn’t a problem when you’re the one who decided to exit the app using, probably, the Quit option from the file Menu; but it is a real pain in those cases where the Mac has to reset or power off, probably due to a software installation process or automated power off mode. In these cases, Stamp was interrupting the process due to that last window… sorry for that, I have to say that I has been the first one suffering from this problem (eating my own food, you know). But I hadn’t the time to fix the bug… until today!
Under the hood
The way to fix that problem is dealing with the macOS Events (aevt)! From the app execution point of view, this is not the same you closing the app that the macOS ordering every open app to close, because the System has something more important to do, as powering off or reseting the computer.
Xojo, the excellent multiplatform development tool I use on most of my apps, is really good by giving you access to all kind of events you can catch in order to put there the code to execute as response. And that is what I do, using the CancelClose event from the App object in order to decide the information and controls to show on that last window when closing the App.
But the way to fix the problem has been to differentiate between the user exiting the App or the System asking the app to close. And for that, there is another Event we can add to the App object on Xojo: HandleAppleEvent. Once added, it is a simple matter of inspect the ‘EventID’ argument value to see if it matches the “quit” string. In that case, the app change the state of a property that is then used on the CloseCancel event code to see if the App exiting process comes from the user or from the System.
Easy!
So, no more cancelled macOS logouts pointing to Stamp as the culprit!
As for the minimum requirements, Stamp works on Mac OS 10.7 and later including the most recent macOS Sierra.
Of course, Stamp is an Apple Developer Signed app, so you can run it on your Mac with absolute confidence.
*This blog entry has been writen in Markdown and exported to HTML using Snippery