GM causing silent crash

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.

Moderator: Klaus

Post Reply
stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

GM causing silent crash

Post by stam » Tue Jan 18, 2022 3:43 am

Hi all,

just spent a couple of days figuring out why a stack i was working on just stopped working...
There are multiple nested groups on several cards and I'd laid out everything with the geometry manager.
Each card has a revUpdateGeometry in it's preOpenCard handler to ensure geometry is always updated - this worked well and provided a fully adaptive interface.

However i redesigned the interface and move some objects and groups around - the app then just stopped working - in particular, some data supposed to be loaded from database on going to card just stopped happening.

I finally figured out that this is because revUpdateGeometry was called before the data retrieval handler and moving the interface objects must have caused issues with GM rules - confirmed by running revUpdateGeometry in the messageBox and getting a non-specific error. Re-setting all GM rules fixed the error.

The question is that since the GM does not seem to raise exceptions where GM rules fail and this leads to halt in script execution, does warrant a bug report? Or is this known/anticipated behaviour?

Sure could have saved a whole lot of time if i had any indication the GM rules were the reason the data wasn't being loaded... but no errors were being generated......

Thanks,
Stam

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4171
Joined: Sun Jan 07, 2007 9:12 pm

Re: GM causing silent crash

Post by bn » Tue Jan 18, 2022 9:59 am

Hi Stam,

I am sorry to hear that the Geometry Manager failed you silently.

I would report it as a bug. Best would be if you have a recipe.

Geometry Manager is a beast and is largely avoided by many including myself because it works when it is simple and can stop working when it is complex.
Brian Milby did some work on it in the recent years and it has apparently improved.

To avoid the Geometry Manager you can easily script the layout of controls yourself. That is easier to maintain than an error in GM which is hard/impossible to track down.
Richard Gaskin strongly advocates writing your own layout code for that reason.

Kind regards
Bernd

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: GM causing silent crash

Post by stam » Tue Jan 18, 2022 12:28 pm

bn wrote:
Tue Jan 18, 2022 9:59 am
I would report it as a bug. Best would be if you have a recipe.
Thanks Bernd,
Bug report is now here: https://quality.livecode.com/show_bug.cgi?id=23521

The error seems to happen with changes in groups that are included in the GM rules.
For example, create a stack with 2 buttons, side by side; set the right button to move with the right edge of the stack and the left button with the right button. Works fine and when resizing the stack, the buttons move as expect and running revUpdateGeometry in the messageBox executes normally.

Now make each button it's own group (so there are 2 groups) - GM will fail with no error on resizing the stack. Running revUpdateGeometry in message box gives the error message:

Code: Select all

Message execution error:
Error description: Chunk: error in object expression
Hint: 
When this occurs it stops script execution, so any code after this error isn't executed. The bug report above is a request to include some error handling in the GM so that the user is notified that the existing rules are invalid (for example linking to an object that no longer exists, or which is part of a different group).

Re: scripting the layout
The thing is that with many objects it will become a massive script and in itself then difficult to maintain. Fine when you have 5 objects, less so when you have 50 or more. Yes, you can group them and move the groups, but sometimes that's not the desired effect and you'll then have to script on resizeGroup as well as on resizeStack.

This is one of the few remaining hangups i have from other languages/IDEs - i expect to do this visually rather than in code because it's a visual layout thing, much in the same way i expect to be able to drag a button to certain location rather than create it and position it in code.
I suspect many long-time HC/RunRev/LC users have learned to this it this way and that's fine, but I, and i suspect many others, expect to to this visually; not to mention new users...

The fact that it doesn't always work as expected should not be a reason to stop using this and by and large, the current state of the GM isn't bad, so i would like to see this fixed.

Stam

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: GM causing silent crash

Post by stam » Tue Jan 18, 2022 12:32 pm

Thinking more about this, if error handling was just added to revUpdateGeometry to flag to the user that current rules are invalid (ideally which exact objects are involved) that would go a long way towards fixing this issue for me...

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4171
Joined: Sun Jan 07, 2007 9:12 pm

Re: GM causing silent crash

Post by bn » Tue Jan 18, 2022 12:35 pm

Stam,

I certainly see your points.

Regarding the bug report: attaching a small sample stack that demonstrates the failing GM easily.
That helps the Quality Control Team to quickly and unequivocally identify the failing GM.

Kind regards
Bernd

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: GM causing silent crash

Post by stam » Tue Jan 18, 2022 1:09 pm

Fair enough, i have attached an extremely simple example of the broken stack to the bug report (two buttons side by side as above, where the right sided button has been turned into a group).

Post Reply