Livecode crashes with copy command

If you find an issue in LiveCode but are having difficulty pinning down a reliable recipe or want to sanity-check your findings with others, this is the place.

Please have one thread per issue, and try to summarize the issue concisely in the thread title so others can find related issues here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
xyz
Posts: 25
Joined: Sat Feb 29, 2020 4:45 am

Livecode crashes with copy command

Post by xyz » Tue Apr 28, 2020 1:43 am

The following code correctly copies the text of a field to the clipboard:

Code: Select all

copy character 1 to -1 of field "Field"
The following code crashes Livecode Community Plus (v9.5.1) running on Mac OS X 10.14:

Code: Select all

copy character 1 to -1 of field "Field" of me
The dictionary suggests that the first is the proper way to perform the operation. I got the second form from the website Fandom https://livecode.fandom.com/wiki/Copy

It is possible that this second form is just wrong, but it seems like this is still a bug (it should have a more graceful exit).

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

Re: Livecode crashes with copy command

Post by bogs » Tue Apr 28, 2020 9:46 am

With out having had tested any of this, my first thought would be the context you are using it in is what is wrong if the script is applied in the same place.

The first statement your using, as an example, clearly lists that you are copying text from a specific field.

The second statement statement implies you are copying the text of a field that resides on / in something that the script is running from, such as a group, card, etc.

Since fields can't host other fields (far as I know), if you ran the 2nd script in a field obj. script, it should crash.

Of course, since I don't see where you say the script is being run from, I could be all wet here too :P
Image

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7727
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Livecode crashes with copy command

Post by FourthWorld » Tue Apr 28, 2020 3:09 pm

Does it crash, or does it throw an error?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

xyz
Posts: 25
Joined: Sat Feb 29, 2020 4:45 am

Re: Livecode crashes with copy command

Post by xyz » Wed Apr 29, 2020 2:56 am

bogs, I simply put a field and a button on a card, then run the scripts in the mouseUp event of the button (at different times, of course).

It crashes.

kdjanz
Posts: 197
Joined: Fri Dec 09, 2011 12:12 pm
Location: Fort Saskatchewan, AB Canada

Re: Livecode crashes with copy command

Post by kdjanz » Wed Apr 29, 2020 4:49 am

Since this code is in a button, the way I understand this

Code: Select all

copy character 1 to -1 of field "Field" of me
is that the code is trying to say that there is a field that is owned or controlled by a button. That is impossible therefore an error or crash results because it does not make sense.

The "of me" construction has to occur in the code that owns the object being referred to - so it would be OK (but redundant) in the field script, but it is not OK in a button because a button can't contain a field.

Just 2 cents from a newbie.

SparkOut
Posts: 2231
Joined: Sun Sep 23, 2007 4:58 pm

Re: Livecode crashes with copy command

Post by SparkOut » Wed Apr 29, 2020 7:41 am

Please file a bug report, as although the syntax is wrong for the situation, the engine should throw an error rather than crash.

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

Re: Livecode crashes with copy command

Post by bogs » Wed Apr 29, 2020 9:57 am

xyz wrote:
Wed Apr 29, 2020 2:56 am
bogs, I simply put a field and a button on a card, then run the scripts in the mouseUp event of the button (at different times, of course).
Heh, well, thanks for confirming that my picturing of it was right.

As kdjanz said, 'of me' is a specific construct referring to the owner of something. A stack owns a card, for example, as you can not have a card just free floating willy nilly out there in space. A group can own many controls. Object controls, such as buttons, fields, etc. can not own any other object control.

As to whether or not that should crash the IDE, I think I'd have to reconsider what I said there, it *should* throw an error, but it should not take the whole works down.
Image

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7727
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Livecode crashes with copy command

Post by FourthWorld » Wed Apr 29, 2020 2:26 pm

Does anyone else see a crash with this code?

Many folks use "crash" for any non-working behavior, such as reported errors.

I had asked for clarification on that but the OP has not answered the question.

If any of you can confirm a true crash, please file a bug report. No scripting language should ever crash.

But if it throws an error the engine is doing what it's supposed to be doing.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

SparkOut
Posts: 2231
Joined: Sun Sep 23, 2007 4:58 pm

Re: Livecode crashes with copy command

Post by SparkOut » Wed Apr 29, 2020 7:31 pm

xyz wrote:
Wed Apr 29, 2020 2:56 am
bogs, I simply put a field and a button on a card, then run the scripts in the mouseUp event of the button (at different times, of course).

It crashes.
^ OP said it crashes, hence the suggestion to file a bug. I am browsing on phone and haven't been able to test so far.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7727
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Livecode crashes with copy command

Post by FourthWorld » Wed Apr 29, 2020 9:11 pm

Rather than keep talking about it, now that I'm at my computer I decided to try it. Hard crash confirmed, bug report submitted:

https://quality.livecode.com/show_bug.cgi?id=22711
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

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

Re: Livecode crashes with copy command

Post by bogs » Wed Apr 29, 2020 10:13 pm

Added tests from Win 7, errors in the debugger in 6.7x, 9.x crashes completely.
Image

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7727
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Livecode crashes with copy command

Post by FourthWorld » Wed Apr 29, 2020 11:19 pm

Thanks for adding those details to the report, Bogs.

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

Re: Livecode crashes with copy command

Post by bogs » Wed Apr 29, 2020 11:29 pm

No problems, while I might never use anything newer, I'd still like to see it improve for everyone else :D (By the way, if you got a mysterious email, that was from me).
Image

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7727
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Livecode crashes with copy command

Post by FourthWorld » Thu Apr 30, 2020 1:39 am

Got it, thanks. Will be replying soon (big in box week).

I was at a Microsoft developer conference some years ago, and the product manager for Visual Basic said something that really resonated with me:

"If you see an error dialog, that's on you. But if you see a crash, that's on us. A scripting language should never crash."

In more recent years LiveCode's Mark Waddingham has expressed a similar sentiment.

It's an ideal, of course, and in the real world pretty much never happens completely with any scripting language. If you poke around the edges of any of them sooner or later you're likely to find a bad address or something else under the hood that results in a hard crash.

But I like the principle. And I like that LiveCode has the same commitment to seeing that put into action as much as practical.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7727
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Livecode crashes with copy command

Post by FourthWorld » Fri May 01, 2020 4:23 pm

Thank you for finding this bug, xyz. The team has addressed the issue, and the fix should be available in the next build.
https://quality.livecode.com/show_bug.cgi?id=22711#c3
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

Post Reply

Return to “Bug Triage”