Understanding 'the defaultStack'
Paul Dupuis
paul at researchware.com
Sun Oct 9 08:40:59 EDT 2016
There is an even worse issue that has cropped up regarding "the
defaultstack" in a multi-window application
If you have a script executing and present a open file/save file dialog
(which are now non-modal windows under OSX and Windows), the user can
click on other application windows, which cause the clicked-on window to
be "topLevel" and hence the new defaultStack and then click backc to the
open file "dialog" (which are not real dialogs any more) and respond.
Your paused script continues executing, but now the defaultStack has
changed.
As a precaution against users of the app doing (resonable) things like
this, I now explicitly set the defaultStack after any ask or answer file
dialog. I also use code such as
on handler
put the defaultStack into tPreserveDefaultStack
set the defaultStack to <this stack by name>
... my code...
set the defaultStack to tPreserveDefaultStack
end handler
So that if the hander is called from another stack it does not exit with
the defaultstack changed.
More information about the use-livecode
mailing list