How to Quit with a button

Richard Gaskin ambassador at fourthworld.com
Tue Dec 9 09:59:32 EST 2014


William Prothero wrote:

 > On Dec 8, 2014, at 2:10 PM, Richard Gaskin wrote:
 >> Interesting.  Any pending messages at the time quit is invoked?
 >
 > I tried doing “Lock messages” before the quit, and closing
 > unused stacks, but it didn’t seem to make any difference.
 > Apparently the toolbar menu quit command does some kind of
 > cleanup before it actually quits.

When I wrote "pending messages" I should have written "pendingMessages", 
e.g. timers ("send <message> in <time>").

For an app to successfully quit two conditions must be met:
1. All stacks are closed
2. All pending messages either complete or are cancelled

It may be that a timer is causing an unexpected interaction with some 
other part of the closing routine.

Of course normally that would only mean the app won't quit, and nothing 
should ever cause a crash in LiveCode - any crash is by definition a bug 
that should be reported so it can be prevented from happening in the future.

The challenge here is to try to figure out the moment the crash occurs.

One solution might be logging:  you could log each routine during the 
quit process to a text file, and the last one written there will be the 
last successful action.

If there are few handlers in play you could add logging to the handlers 
themselves, and if there are many it may be useful to turn on the 
messageMessages global property and have a frontScript trap the 
messageHandled message to do the logging, so you'll have one place to 
handle logging that can easily be disabled once this diagnostic stuff is 
behind you and we've found the root cause.

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list