how to clear residual garbage in a stack?

Neville Smythe neville.smythe at optusnet.com.au
Fri May 25 22:24:06 EDT 2018


So now we have confirmed the “delete-card-with-unshared-textfield-leaves-unreferenced-text-which-compact-does-not-remove” bug (thanks to Brian and Richard) the question remains how to actually remove the garbage.

As Brian says deleting the background groups will remove the residual text; you then  have the task of replacing the groups. I have found that a simpler method: turning on sharedText, then turning it back off and replacing text also works.

So, a recipe is
1. Copy the target stack, don’t work on the original
2. Go through the stack (and its substacks) to find background groups which have fields with sharedText false (this is an outer loop for each stack)
3. Find all cards which such groups
4. Save the text from every found field from every found card into an array
5. Turn on sharedText for each field
6. Visit each card and put empty into each found field (not sure if this step is necessary, but I think it is)
7. compact the stack
8. Turn off sharedText for each field
9. Visit each card to replace the individual text saved in the array
10.Save the stack.

Sounds complex but the process took only a couple of seconds to clean up my  9MB stack with 325 cards + lots of substacks and lots of groups. It saved 1.5MB, not as much as I was hoping but still worthwhile. That’s 15% off the time Windows 10 users have wait for save to finish.

This is not a workaround for the bug. It is a fix for affected stacks.
  
Neville Smythe



More information about the use-livecode mailing list