How to Quit with a button

William Prothero prothero at earthednet.org
Tue Dec 9 10:48:12 EST 2014


Richard:
There really is no code in the quit button. I just do:

——Method 1 ------
on mouseUp
   quit
end mouseUp

Or:
——Method 2 ------
on mouseUp
   send “doTheQuit” to me in 0 seconds
end mouseUp

on doTheQuit
   quit
end doTheQuit

I tried closing all substacks. Do I need to close the mainstack first too?

Bill

On Dec 9, 2014, at 6:59 AM, Richard Gaskin <ambassador at fourthworld.com> wrote:

> 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
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list