Cannot really purge

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

bogs
Posts: 2173
Joined: Sat Feb 25, 2017 10:45 pm

Re: Cannot really purge

Post by bogs » Wed Mar 07, 2018 9:38 pm

Dunno, but I am probably reading the docs incorrectly :(
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5525
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Cannot really purge

Post by dunbarx » Thu Mar 08, 2018 2:55 am

All.

This has turned into a lively discussion.

"doMenu" does not work in this case. In fact, ever since I started LC I have found that it mostly does not, and therefore I have abandoned ever thinking about it. However, If it did work here, I would jump on it, and make my plug-in to trap all "close" messages, since I always want full purging.

Anyway, I will jump in tomorrow and let everyone know.

But that still begs the issue that the "purge"-like settings di nothing for me at all.

Craig

bogs
Posts: 2173
Joined: Sat Feb 25, 2017 10:45 pm

Re: Cannot really purge

Post by bogs » Thu Mar 08, 2018 4:56 am

dunbarx wrote:
Thu Mar 08, 2018 2:55 am
But that still begs the issue that the "purge"-like settings di nothing for me at all.
We are talking about in the IDE though, not in a standalone where I am pretty sure it does exactly as intended. In the IDE, I think slightly different rules apply, I suspect for good reasons.
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5525
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Cannot really purge

Post by dunbarx » Thu Mar 08, 2018 5:34 am

We are talking about in the IDE though, not in a standalone where I am pretty sure it does exactly as intended. In the IDE, I think slightly different rules apply, I suspect for good reasons.
Hmmm.

I never thought about it that way. i assume that a standalone would not contain multiple instances of the same stack. But I guess it could be so. But this is not an issue of LC throwing an error, though a modal dialog does indeed have to be manually dismissed, and that could cause the standalone to fail.

Anyway, I think rather it is in the IDE that such methods, of working with several versions of a stack as one develops, is more common.

Is it not so?

Craig

bogs
Posts: 2173
Joined: Sat Feb 25, 2017 10:45 pm

Re: Cannot really purge

Post by bogs » Thu Mar 08, 2018 5:44 am

dunbarx wrote:
Thu Mar 08, 2018 5:34 am
Anyway, I think rather it is in the IDE that such methods, of working with several versions of a stack as one develops, is more common.
Is it not so?
Yes, I'd agree with that, but there is a specific method to do that as well, you'd clone the stack (as many times as you like), and work on each copy of it. Alternately, you could save each variation, changing the name of the stack slightly , i.e. myStack1, myStack2, etc. which is the easiest way, especially if you have a ton of substacks below it.

I haven't tested what happens if you have a substack that is the same as another substack open at the same time yet though. Hmmm. Wonder if the universe explodes at that point... :twisted:
Image

bwmilby
Posts: 203
Joined: Wed Jun 07, 2017 5:37 am
Location: New Orleans, LA
Contact:

Re: Cannot really purge

Post by bwmilby » Thu Mar 08, 2018 7:10 am

I just created some test stacks and cannot reproduce this issue. I'm using DP11 on Win10.

I created a new default stack (named Untitled 1). I checked the "Purge stack on close" option using the stack inspector. I saved the file on the desktop. I closed the file with the "x" and verified that it no longer appeared in the PB.

On the desktop, I created 2 new folders: f1 and f2. I copied the stack file and placed a copy in each folder.

In LC, I opened the one in f1 and closed it. I then opened the one in f2 and closed it. I did not receive any dialog boxes to purge. I can use the recent files to open any of the 3 copies of the file without a dialog as long as the previous is closed with the "x".

I also saved a copy to the desktop without the purge option checked (same stack name, different file name). If I open that stack and close with the "x", I will get a purge dialog when attempting to open another copy of the stack.

So, my thought is that there is something else going on that is keeping your particular stack in memory. Is the stack in question a sub-stack of something else or does it have sub-stacks? Does any other object in memory reference it (as a behavior for example)?

One example that I came up with was to open one of those stacks and create a sub-stack. If that sub-stack was open, then the parent would not get purged until the sub-stack was closed. If I closed the sub-stack first, then the parent was immediately purged when closed (even without saving the file with the new sub-stack).

- Brian
Brian Milby

Script Tracker https://github.com/bwmilby/lc-misc/tree/master/ScriptTracker

bogs
Posts: 2173
Joined: Sat Feb 25, 2017 10:45 pm

Re: Cannot really purge

Post by bogs » Thu Mar 08, 2018 2:17 pm

Huh, i had read (and forgotten) that the mainstack won't close out completely until all the substacks had closed, but didn't think about it in this case. That makes a lot of sense taken in that context. Now to remember where I read it :roll:
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5525
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Cannot really purge

Post by dunbarx » Thu Mar 08, 2018 3:52 pm

Brian.

You make an excellent point, in that perhaps a substack may not have those properties set, and complain about their lowly status. And my mainstack does indeed have four substacks.

But all four have both properties set.

I am on a Mac, LC 8.1.8, but this issue has been forever.

Going to see if I can access the menuItem as Bogs suggested, and then make a plug-in to purge always.

Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2712
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: Cannot really purge

Post by richmond62 » Thu Mar 08, 2018 7:42 pm

My earlier remark
Probably because "Close and Remove From Memor&y" is NOT one word.
is nonsense because this:

Code: Select all

on mouseUp
   send "menuPick New Card" to btn "Object" of stack "revMenubar"
end mouseUp
worked perfectly.

So, missing something. :?

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2712
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: Cannot really purge

Post by richmond62 » Thu Mar 08, 2018 7:46 pm

I was missing something!

I was 'DISTRACTED' by the ampersand!

This:

Code: Select all

on mouseUp
   send "menuPick Close and Remove From Memory" to btn "File" of stack "revMenubar"
end mouseUp
Cuts the mustard.
Screen Shot 2018-03-08 at 8.45.51 pm.png

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5525
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Cannot really purge

Post by dunbarx » Thu Mar 08, 2018 8:29 pm

Thanks to all.

I should have been able to find this for myself, since I am the one who constantly tells anyone who will listen that everything in the LC IDE is merely a stack. But that is why this forum is so useful.

I made a simple plug-in, with this in its stack script

Code: Select all

on closeStack
 send "menuPick" &&  "Close and Remove From Memory" to btn "File" of stack "revMenubar"
 end closeStack
@Richmond. I like my slight modification better. Just old practice; LC could care less.

Interestingly, when on invokes this directly from the menuBar a dialog pops up asking if this is really what is desired. I say yes and it works. But when simply closing a stack, no such dialog appears. Why, I wonder?

Anyway, no more dialogs asking about purging. :D :D :D

Craig

bogs
Posts: 2173
Joined: Sat Feb 25, 2017 10:45 pm

Re: Cannot really purge

Post by bogs » Thu Mar 08, 2018 8:31 pm

Nice Richmond, glad you got the (amper) sand out of your eye :D

Congrats Craig :)
Image

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

Re: Cannot really purge

Post by jacque » Fri Mar 09, 2018 5:23 pm

You're getting the dialog because that's what the menu item does. Closing a stack by its close box doesn't call the menu.

I think there is something specific about your stack that prevents it from closing completely. The window will close but it remains in memory. There are a few things that could cause this: the stack is in use as a library or back/front script; a handler has not completed; it has opened a driver or external and hasn't closed it; other things I can't remember right now.

Basically if the stack sets up a dependancy it won't close until the dependancy is removed. I suspect you wouldn't have the same problem if you tested with several plain, same-named stacks.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5525
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Cannot really purge

Post by dunbarx » Fri Mar 09, 2018 6:32 pm

Jacque.
There are a few things that could cause this: this...
That all makes sense. But unfortunately for me, I have never subscribed to making sense.

So I made two new empty stacks. I set the usual suspects. I always get the dialog closing and re-opening them in succession.

This does not mean it is not me. just that it is not me.

Craig

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

Re: Cannot really purge

Post by jacque » Fri Mar 09, 2018 7:43 pm

I just repeated your experiment and didn't get any warning dialogs. I could open/close both test stacks without interference. What version of LC are you running?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Talking LiveCode”