Let me improve this a bit.
On 2/23/18 4:19 PM, Phil Davis via use-livecode wrote:
Roland,
I believe Tom is exactly right. I would restructure your two closing
handlers like this:
local sMyFilename
on closeStack
put the filename of me into sMyFilename
saveMe
send "quitMe" in 1 second
end closeStack
on closeStack
put the filename of me into sMyFilename
send "quitMe" to me in 1 second
saveMe
end closeStack
"quitMe" should be sent before 'saveMe' is executed, because the 'save'
command is blocking. It would prevent 'quitMe' from being sent until (in
this case) 1 second after 'saveMe' has finished.
Thanks -
Phil
command saveMe
lock cursor /* Tested with and without locking and showing cursor */
set the cursor to watch
save this stack /* auto save, takes a long time, between 10-30 secs */
end saveMe
command quitMe
if there is a file sMyFilename then
unlock cursor
lock messages
quit
else
send "quitMe" to me in 0.5 seconds -- or in your preferred time
end if
end quitMe
The above was not tested but it should solve the problem.
HTH -
Phil Davis
On 2/23/18 3:20 PM, tbodine via use-livecode wrote:
Hi Roland.
The "~" file is the original (uncorrupted, unsaved) version of your
stack
before LC executed your Save cmd. If you remove the "~" from the
filename,
you'll probably find you can open that. LC creates the "~" file at
the start
of the save operation and, if all goes well, removes that file when
save is
complete.
My guess is your problem is rooted in the lengthy save time in the quit
routine. Here are a couple ideas of how you could deal with that:
1) Do the save within a try/catch statement so you can deal with any
error.
2) If you are just saving some user data like prefs or fairly minor
stuff,
then why not save that into a separate substack outside of your main
application stack? That should greatly shorten the time it takes to
save.
Hope that helps.
Tom Bodine
--
Sent from:
http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
--
Phil Davis
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode