Page 1 of 1

Simple handler crashes LC or worse

Posted: Sun Jun 07, 2015 2:51 pm
by dunbarx
Make a new stack. Make a new field. Put some text into it. Put this into its script:

Code: Select all

on rawKeyDown theKeyNumber
  get word 2 of the selectedChunk
   if theKeyNumber is 65288 then delete char it - 1 of the selectedChunk
end rawKeyDown
Set the cursor in the text somewhere and press backSpace. I can reliable either crash LC , or, now and then, I find that the selectedChunk is copied after the selection. Or both. This came about by accident while fooling around with a handler in a beginners thread query.

I have the stack, and would like someone to either teach me LC or verify the instability OSX 10.9, LC 6.7.4.

Craig Newman

Re: Simple handler crashes LC or worse

Posted: Mon Jun 22, 2015 12:39 am
by sturgis
You're right, It seems the engine doesn't like trying to delete a char from a return value (IE delete char 104 of "char 94 to 93 of field 1") Its trying to delete a char from "the selectedchunk returned string, rather than the field. 7.0.5 spits up too. (though no hard crashes, just compiler errors on run)

I don't actually think it should work, but a more informative and reliable error would be nice.

Re: Simple handler crashes LC or worse

Posted: Tue Jun 23, 2015 3:00 pm
by dunbarx
Thank you, Sturgis.

I submitted a bug report.

Craig

Re: Simple handler crashes LC or worse

Posted: Tue Jun 23, 2015 3:14 pm
by FourthWorld
Do you get the same result if you use the backSpaceKey message instead of trapping it through rawKeyDown?

Re: Simple handler crashes LC or worse

Posted: Tue Jun 23, 2015 3:24 pm
by sturgis
As written, it just pian shouldn't work. When everything is resolved it ends up looking like the following:

Code: Select all

delete char 26 of char 12 to 16 of field 1
Or if there is only an insertion point..

Code: Select all

delete char 29 - 1 of char 29 to 28 of field 1


Strangely, now I can't get it to crash, it doesn't actually delete a char but does move the cursor to the beginning of the selection if there is one. Ending with an insertion point and no selection.
(it should just be deleting char 29-1 of field 1 of course.)

Re: Simple handler crashes LC or worse

Posted: Tue Jun 23, 2015 3:51 pm
by dunbarx
@Richard.

BackSpaceKey message also crashes LC.

@Sturgis. Hmm. I can now crash reliably in two ways, thanks to Richard. I will amend the bug report.

Craig

Re: Simple handler crashes LC or worse

Posted: Tue Jun 23, 2015 4:23 pm
by FourthWorld
What's the bug report ID?

Re: Simple handler crashes LC or worse

Posted: Tue Jun 23, 2015 4:41 pm
by dunbarx
Richard.
What's the bug report ID?
15539

Craig