Delete Stack Different in LiveCode 6?

Are you developing tools to extend the LiveCode environment? This is the place to talk about the nuts and bolts of extending our nuts and bolts. If you want to use a LiveCode or third party Environment extension, visit the Using Evironment Extensions forum.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
stephenmcnutt
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 107
Joined: Fri Nov 10, 2006 8:58 pm
Contact:

Delete Stack Different in LiveCode 6?

Post by stephenmcnutt » Sat Oct 05, 2013 12:20 am

Only a couple months ago, I was having trouble with the "close stack" command because it doesn't always close a stack immediately. I posted "Close Stack Doesn't Close Stack?" (http://forums.runrev.com/phpBB2/viewtop ... =9&t=15561) and from people's helpful replies, I learned that I should use "delete stack" instead because it DOES close the stack immediately and doesn't actually delete the stack unless it's a substack. Problem solved.

Today I finally upgraded to LC 6.1.1 from 5.5.4, and my "delete stack" lines are now throwing the error "can't delete object". I checked the documentation by highlighting the word "delete" in my script, clicking the Documentation tab below, and clicking Launch Documentation. The documentation contains no documentation of any change to the "delete stack" command. I suppose that doesn't surprise me because none of the information I learned in my "Close Stack Doesn't Close Stack?" post is to be found in the documentation, either. :-(

So once again I ask the kind people who answer these posts and who somehow know things not documented in the documentation to please help me.

kray
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 56
Joined: Sat Apr 08, 2006 5:28 pm
Location: Eau Claire, WI
Contact:

Re: Delete Stack Different in LiveCode 6?

Post by kray » Sat Oct 05, 2013 4:36 pm

I've used "delete stack" in 6.1.1 with no issues... Is it possible your stack is not open at the time the command is executed? If it is actually open, can you show us the complete line of code that you're executing (in context if you can) so we can review it?
Ken Ray
Sons of Thunder Software
Email: kray@sonsothunder.com
Web site: http://www.sonsothunder.com

stephenmcnutt
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 107
Joined: Fri Nov 10, 2006 8:58 pm
Contact:

Re: Delete Stack Different in LiveCode 6?

Post by stephenmcnutt » Sat Oct 05, 2013 5:14 pm

Thanks for the help, Ken. The stacks I'm trying to "delete" (close) are in fact open, as this LC 6.1.1 screenshot shows. Notice the Project Browser.
2013-10-05_11-49-17.jpg
If I open the same LiveCode project file in LC 5.5.4, it opens just fine with no errors and being as fully functional as ever. From the Application Browser, you can see that all three data files that I "delete" in my preOpenStack handler have been closed.
2013-10-05_11-53-47.jpg
Another weird thing is that I did NOT get the error the first time I opened the file in LC 6.1.1. In fact, I was able to build a stand-alone that time. Although this version of my application is the final one I intend to build with LC 5.5.4, I decided to try moving it into LC 6.1.1 because I'm having trouble getting the application signing necessary for Mac App Store submission done properly--though I've done it successfully for the past couple years. I figured maybe the info.plist file generated by LC 6.1.1 might have some updates that might solve my new signing problems. That's irrelevant to my error, I suppose, but it is strange that I didn't get the error the first time I opened my file in LC 6.1.1. Although I did save my file prior to building the stand-alone, I made no changes to the script whatsoever. Could there be some problem with having LC 5.5.4 and LC 6.1.1 coexisting on my computer? Might 6.1.1 be relying on some files in the 5.5.4 folder or perhaps elsewhere like in the Library/Application Support folder that it would otherwise rebuild anew for itself?

stephenmcnutt
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 107
Joined: Fri Nov 10, 2006 8:58 pm
Contact:

Re: Delete Stack Different in LiveCode 6?

Post by stephenmcnutt » Sat Oct 05, 2013 5:29 pm

Note to Forum Moderators: I somehow managed to post this in the wrong place. I meant to post it in the Intermediate >> Talking LiveCode forum, where I believe it belongs. If you'd like to move it there or just delete this post and let me know so I can put it in the right place, that'd be just fine. Sorry for the trouble.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7210
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Delete Stack Different in LiveCode 6?

Post by jacque » Sat Oct 05, 2013 8:03 pm

You don't need to use the delete command if the stack's destroystack is set to true. Just closing the stack will remove it from RAM in that case. So you've got a little duplication there, though it theoretically shouldn't hurt anything.

A stack will not delete if any of its scripts are running or in use. If the stacks have closestack/closecard etc. handlers then they are trying to executre while the script is trying to delete them. I usually issue a close command first, and a delete command next to accomodate that:

close stack x
if there is a stack x then delete stack x

I check for existence so that it doesn't matter whether destroystack is true or not -- if it is, there won't be a stack x. If it isn't, then the delete command executes because the stack is still in RAM.

If you use this method, you can remove all the "set destroystack" lines from your code.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

stephenmcnutt
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 107
Joined: Fri Nov 10, 2006 8:58 pm
Contact:

Re: Delete Stack Different in LiveCode 6?

Post by stephenmcnutt » Sat Oct 05, 2013 8:41 pm

Thanks, Jacque. However, I found in troubleshooting my original problem with "close stack" in LC 5.5.4 (see linked post in in this topic's first post) that "close stack" doesn't reliably close the stack in a timely manner. Probably it does in most cases, but for me it wasn't, and it wasn't because any of the stack's scripts were still runnnng. This is the whole reason I switched to "delete stack". I do realize the destroyStack settings are no longer needed with "delete stack".

The mystery, though, is why the exact same LiveCode project file throws an error with LC 6.1.1 and doesn't with LC 5.5.4. I can still drag the file onto the LC 5.5.4 icon, and it starts up just fine with no error.

I realize that requirements change as LC evolves. I opened that fine stack "Signing Assistant" by Obleo Bleck, who must be known to all who struggle with getting our LC apps submitted to the Mac App Store, and when I tried to modify and save the script, I found all sorts of things that now throw errors but didn't when he so kindly wrote it. For example, there were a lot of undeclared local variables and an unquoted literal. (These problems might actually stem from settings in my LC prefs, now that I think about it, but...) I'm sure my present problem is much the same. It could even be that they've changed the "delete stack" handler so that it only does what it's supposed to do—delete stacks not serve as a more reliable pinch hitter for "close stack". Well that's probably not true because the first reply to this topic said "delete stack" still works. Still, something has changed. I think that's proven Q.E.D. by my files different behavior in 5.5.4 and 6.1.1. I've just got to discover what.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7210
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Delete Stack Different in LiveCode 6?

Post by jacque » Sun Oct 06, 2013 12:24 am

I haven't seen any differences, so I'm not sure what to say. I'm pretty sure if there had been a change to such basic functions, the release notes would have had a prominent warning, since those commands have remained the same since version 1.0 of MetaCard and a change would break everybody's stacks.

EDIT: if your original "close stack" commands weren't closing immediately then that would indicate to me that they are in fact running some scripts. Normally stack closure is instant, regardless of the destroystack setting. Also, note that "delete stack" will remove the stack from RAM immediately without running any scripts or sending any messages. If you have handlers that need to deal with the stack closing, they won't run.

Since you haven't missed that, it makes me think that you have a closestack or closecard handler that is catching all closures, even when they aren't intended for the data stacks. Hard to say without seeing the stacks in action though.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

kray
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 56
Joined: Sat Apr 08, 2006 5:28 pm
Location: Eau Claire, WI
Contact:

Re: Delete Stack Different in LiveCode 6?

Post by kray » Sun Oct 06, 2013 10:23 am

stephenmcnutt wrote:I opened that fine stack "Signing Assistant" by Obleo Bleck, who must be known to all who struggle with getting our LC apps submitted to the Mac App Store, and when I tried to modify and save the script, I found all sorts of things that now throw errors but didn't when he so kindly wrote it. For example, there were a lot of undeclared local variables and an unquoted literal. (These problems might actually stem from settings in my LC prefs, now that I think about it, but...)
Yes, it sounds like you had Strict Compilation mode on...
Ken Ray
Sons of Thunder Software
Email: kray@sonsothunder.com
Web site: http://www.sonsothunder.com

gwjvanGA9df0
Posts: 2
Joined: Tue Jan 24, 2012 10:35 am

Re: Delete Stack Different in LiveCode 6?

Post by gwjvanGA9df0 » Wed Oct 30, 2013 5:56 am

It might not be this simple for you, but I ran into a similar issue when testing LiveCode 6.1.2 on some stacks of ours.

It appears that since at least LiveCode 6.0.1 the cantDelete of stacks is now respected. We had some stacks with cantDelete set to true, and then had scripts which ran "delete stack" on them. In pre-6.0 LiveCode it worked fine. Then, in testing 6.1.2 it started failing. Once I set the cantDelete to false, it worked again. Your issue might not be this simple, I just thought I'd share what I found.

Post Reply

Return to “Making IDE Plugins”