Page 1 of 3

LC can drive you nuts

Posted: Thu Apr 22, 2021 6:53 pm
by dunbarx
I have a mainStack and a subStack. In the middle of a handler in the mainStack I navigate to the substack. All of a sudden, after weeks of no issues, and though the navigation itself works fine, program flow ceases, as if I exited to top.

There was this in the subStack stack script:

Code: Select all

on closeStackRequest
   save  stack "shapes"
   close stack "shapes"
end closeStackRequest
I placed a breakpoint in that handler (as I did everywhere in the subStack) to try to see what might be firing in the substack. Nothing, ever. No breakpoint ever caught anything.

Commenting that handler out, however, fixed the issue. And when I made the handler whole again, no changes at all, the problem went away. It took me more than just a little while to ferret this out. I know life isn't perfect, but anyone ever see anything like this?

Craig

Re: LC can drive you nuts

Posted: Thu Apr 22, 2021 7:05 pm
by richmond62
anyone ever see anything like this?
Sorry, busy trying to source some Lithium tablets (illegal in Bulgaria) . . . 8)

Re: LC can drive you nuts

Posted: Thu Apr 22, 2021 8:32 pm
by SparkOut
No but as a guess, is it hitting some recursion limit or something? Just as a thought, what if you change the

Code: Select all

close stack "shapes"
line to

Code: Select all

pass closeStackRequest

Re: LC can drive you nuts

Posted: Thu Apr 22, 2021 9:16 pm
by dunbarx
@Richmond.

Not a bad idea.

@Sparkout.

The handler never fired; no handler in the subStack ever did. That is the odd thing. Breakpoints in all card and stack handlers never caught anything, so I don't think it mattered what the actual code was in any of them.

Commenting and then uncommenting fixed it. Pure happenstance.

Craig

Re: LC can drive you nuts

Posted: Fri Apr 23, 2021 2:22 am
by mwieder
I find that on the occasions when I have to paste something from an rtf file into the script editor, there are invisible characters where there should be empty lines, and these cause errors. I can backspace through them to delete them (seven IIRC - six spaces followed by an invisible backslash) or I can comment the line out and that also removes them. Thus uncommenting the empty line will act normally.

Re: LC can drive you nuts

Posted: Fri Apr 23, 2021 4:36 am
by dunbarx
Mark.

I am not so smug as to think that I have no invisible errors in my thinking and coding.

But I did not change the handler. I only placed a red dot at it, which did not catch anything. I then commented the whole with CMD-Dash, and then uncommented with SHIFT-CMD-Dash. Of course, this will not be the first time that things have "fixed" themselves on their own. Just life, I suppose.

Craig

Re: LC can drive you nuts

Posted: Fri Apr 23, 2021 4:40 am
by mwieder
Craig-

Yes, note that I "fixed" the errant lines of code with invisible characters by commenting/uncommenting them as well.
Go figger. :roll:

Re: LC can drive you nuts

Posted: Fri Apr 23, 2021 3:06 pm
by SteveFI
I know exactly how you mean about going nuts. I've come back to LC after being away for 10 years or so and have been making really good progress on some apps for work. I don't get regular time for them, so it's a few hours here, maybe as much as a day elsewhere. I'm enjoying it so much, I'm happy to throw some of my own time into it.

But today, I had a big head scratcher. A routine that constructs an output in rtf format and then draws lines over the top to signify totals and subtotals would stop drawing graphics once it got to the 26th (there are 50 in total). Even more inexplicably, graphics 27 to 50 would draw over the top of the 26th.

I read up on formattedRect, rewrote code to control the dimensions of the field and the group it's all in (which handles resizing and factors tab widths), trawled the forums and even outputted progress on what it was doing to a field. After walking away, making a cup of tea and returning, I spotted the wrong variable in a line. I'd looked over the code umpteen times.

What does impress me is how awesome the language is. So many times I've gone to do something, have a little read up in the dictionary on a key word I remembered, spot another related word and find an even better way to do something.

Re: LC can drive you nuts

Posted: Fri Apr 23, 2021 4:51 pm
by mwieder
Yep. As they say, the language gives you enough rope to shoot yourself in the foot. And if you didn't know you could do that, you should have read the manual.

I've often found the best way to deal with a gnarly problem is to step away and go do something else for a while. Solutions will come to me when I'm pulling weeds in the garden or taking a shower or driving somewhere and thinking of something else.

Re: LC can drive you nuts

Posted: Fri Apr 23, 2021 4:56 pm
by richmond62
Solutions will come to me when I'm pulling weeds in the garden or taking a shower or driving somewhere and thinking of something else.
Words of true wisdom.

Personally I tend to draw a hot bath and soak while listening to some Baroque music and a glass of semi-decent wine.

https://youtu.be/zja9ANxZ4Ko

Re: LC can drive you nuts

Posted: Fri Apr 23, 2021 5:17 pm
by dunbarx
Richmond.

Really.

I did not open the link, but I so hope it was not a video of you taking a bath, whatever the temperature of the water. :shock:

Craig

Re: LC can drive you nuts

Posted: Fri Apr 23, 2021 5:54 pm
by kdjanz
No Craig.

It was a baroque music concert - Hayden Organ concerto. Good taste, but a bit over the top for my taste.

All good here and safe for the kiddies.

Re: LC can drive you nuts

Posted: Fri Apr 23, 2021 6:12 pm
by dunbarx
Nuts.

The issue has re-emerged again today. As before, with this in the stack script of a substack:

Code: Select all

on closeStackRequest
   save  stack "shapes"
   close stack "shapes"
end closeStackRequest
A handler in the mainStack that navigates to that subStack will indeed go there, but then execution stops at that line. However:

1- If the subStack is already open, then the mainStack handler works just fine all the way to its end.
2- If I comment out the above subStack handler, then the mainStack handler works just fine all the way to its end.

I have ways around this, I just don't get it. What on earth has a closeStackRequest in a subStack have to do with the mainStack handler? Did I mention that a breakpoint in the closeStackRequest never fires?

A brand new stack/substack with a navigation handler in the mainStack and the above handler in the substack works just fine. I am not surprised, just nuts.

So there is something about my project stacks. Shocking, I know. But how do I find out what, if no breakpoint ever fires? In other words, what is the difference between a handler that is never used, and a handler that does not exist at all? How do it know?

Craig

Re: LC can drive you nuts

Posted: Fri Apr 23, 2021 7:05 pm
by richmond62
Craig, not wanting to disappoint you . . .
-
elephant-bathtub-pours-water-over-himself-rubbing-sponge-bath-time-isolated-191317061.jpeg

Re: LC can drive you nuts

Posted: Fri Apr 23, 2021 7:28 pm
by FourthWorld
Do you have a simple sample stack that would allow us to see the issue here?