Consistent crash related to GUIs (reading AbsoluteSize seems to be the culprit)

,

Description:

When I execute a script, studio crashes. This script runs some unit tests for a project of mine which adds a layer of functionality on top of the GUI system, and thus, interacts with it heavily.

Steps to Reproduce:

Start by downloading this game: GuiWidgets.rbxl (264.1 KB)
It’s configured to run some unit tests when you hit “run”. Do so.
I crash 100% of the time.

I can’t really give a minimal repro because I don’t understand the bug. Would happily hook up a debugger if I had a build with debug symbols…

Additional Info:

The only lead I have is that it’s related to reading AbsoluteSize, as if I “prime” the variable by reading it before I kick off a series of events, the crash goes away. Of course, this isn’t a great solution because it’s hard to track down which exact line is causing the segfault.

I also was contacted ~8 months ago by someone who is monitoring crash statistics since I was binary searching my way through the code base to find the line at fault and caused studio to crash ~70 times. They filed this bug right into the trash bin. I’m just nagging at this point in hopes someone else sees it.

1 Like

I made a fix for this in January, but it had to be rolled back because it caused issues, and the followup ticket is still sitting in the backlog.

The issue here is when you change the GUI hierarchy in the middle of a AbsoluteSize Changed event, it interrupts a UI relayout operation, leading to a crash that should not happen. Your code is one of the only known samples we’ve seen of someone doing this.

1 Like

Honestly, I take pride in this. Nobody is as insane as me!

But thanks for the root cause, at the very least. I can probably refactor my AbsoluteSize changed handlers to defer things to the end of the frame.

1 Like