In 2017 I reported a bug related to opening a series of stack files all with 
the same name. The problem was that I could not get the old stacks to go away 
and eventually I would end up in the “duplicate stack name” dialog infinite 
loop.

https://quality.livecode.com/show_bug.cgi?id=19075

Panos suggested putting a lock messages / unlock messages set of statements 
around the code that opened and accessed each stack and that did seem to fix 
the problem I was having (though not the bug in LiveCode).

Maybe you could do something similar here?

Another thing I considered was to rename each old stack with a unique suffix so 
that the names would no longer clash, even if the stack ended up staying in 
memory for longer than necessary…


> On 6 Apr 2023, at 13:45, Håkan Liljegren via use-livecode 
> <use-livecode@lists.runrev.com> wrote:
> 
> Thanks for the tip! But unfortunately already tried that! I only try to work 
> with one stack at a time.
> 
> If I set a breakpoint and step over the line
> delete stack “teststack"
> 
> And then try to open a new stack with the same name there is no dialog box
> If I run the same code (without any breakpoints). I can wait forever (well 
> kind of) and the stack will still be among the mainStacks. If I run your 
> suggest code with a counter addition:
> 
> repeat while "teststack" is among the lines of the mainStacks
>      delete stack "teststack"
>      add 1 to tCount
> end repeat
> put tCount
> 
> I get an output of 1 but again if I bring up the message box after the code 
> Is executed and do a “put the mainStacks” the stack is back again! If I run a 
> loop over all my 25 stacks (or so) with the same name using the code above it 
> loops through several stacks in quick succession but then I got the dialog 
> again, and again, and again, and again… until I force quitted LiveCode.
> 
> Created there stacks teststack1, 2 and 3 in the same folder all with the same 
> name “teststack”. If I then run the following code from another stack in the 
> same folder:
> 
>   set the itemDelimiter to slash
>   put item 1 to -2 of the filename of this stack into tPath
>   repeat with i = 1 to 3 
>      open stack tPath & "/teststack" & i & ".livecode"
>      repeat while “teststack" is among the lines of the mainStacks
>         delete stack "teststack"
>      end repeat
>   end repeat
> 
> Then I get a dialog asking what I want to do with teststack1 before I load 
> teststack2 and teststack2 is still open after the code has run! If I create 6 
> stacks and run the same code (but from 1 to 6 of course) I get into the 
> unstoppable dialog loop and needs to quit LiveCode! 
> 
> I’ve update the bug report https://quality.livecode.com/show_bug.cgi?id=24163 
> with new example ( https://quality.livecode.com/attachment.cgi?id=11421 ) 
> that causes my LiveCode to get into the endless dialog loop. So, don’t run 
> this if you have unsaved work in another stack!
> 
> If it works for you Jacqueline, what platform are you using? Maybe this is a 
> Mac only problem? I’m running MacOS Ventura 13.1 on a MacBook Pro (M1 Max).
> 
> :-Håkan
> 
>> On 5 Apr 2023, at 21:27, J. Landman Gay via use-livecode 
>> <use-livecode@lists.runrev.com> wrote:
>> 
>> I just created four same-named stacks and ran my suggested handler wrapped 
>> with timer commands. All four were deleted in 67 milliseconds. LC 10.0.0 DP 
>> 4.
>> 
>> put the milliseconds into tStart
>> repeat while "test" is in the mainstacks
>>  delete stack "test"
>> end repeat
>> answer the milliseconds - tStart
>> 
>> Ralph's idea to use filter is good too but slightly slower, at (a fairly 
>> insignificant) 79 milliseconds:
>> 
>> put the milliseconds into tStart
>> filter the mainstacks with "test*" into tStacks
>> repeat for each line l in tStacks
>>  delete stack l
>> end repeat
>> answer the milliseconds - tStart
>> 
>> On 4/5/23 10:15 AM, Bob Sneidar via use-livecode wrote:
>>> Whoa! No I'm not! There's over 300 mainstacks just from Livecode!
>>> Bob S
>>> On Apr 5, 2023, at 08:07, Bob Sneidar via use-livecode 
>>> <use-livecode@lists.runrev.com> wrote:
>>> Oooh Pro Tip #276 from Jacque. I'm gonna use that one.
>>> Bob S
>>> _______________________________________________
>>> 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
>> 
>> -- 
>> Jacqueline Landman Gay         |     jac...@hyperactivesw.com
>> HyperActive Software           |     http://www.hyperactivesw.com
>> 
>> 
>> _______________________________________________
>> 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
> 
> _______________________________________________
> 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 Jimmieson (He/Him)
University of Liverpool, Computer Science Department
Ashton Bldg, Ashton Street, Liverpool. L69 3BX
0151 795 4236



_______________________________________________
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

Reply via email to