Page MenuHome

Fix T87688: Crash entering valid text into number field
ClosedPublic

Authored by Falk David (filedescriptor) on Apr 22 2021, 10:58 AM.

Details

Summary

When the user entered a driver expression like #frame into a number
field, Blender would crash sometime after. This is because
e1a9ba94c599 did not handle this case properly and ignored the fact
that the user can enter text into the field.

The fix makes sure that we only cancel if the value is a *number* equal
to the previous value in the field.

Note that this could also be handled by ui_but_string_set which would
be a bit nicer potentially. However, I was unable to find a clean way of
passing data->startvalue into that function. uiHandleButtonData is
only known locally inside interface_handlers.c.

Diff Detail

Repository
rB Blender
Branch
T87688 (branched from master)
Build Status
Buildable 14176
Build 14176: arc lint + arc unit

Event Timeline

Falk David (filedescriptor) requested review of this revision.Apr 22 2021, 10:58 AM
Falk David (filedescriptor) created this revision.

Calling ui_but_string_eval_number() earlier and returning early like you do it here should be fine, hopefully there are no other side effects (always hard to tell).

source/blender/editors/interface/interface_handlers.c
1130–1131

Code style: Don't use else after return.

This revision is now accepted and ready to land.Apr 22 2021, 6:23 PM
Falk David (filedescriptor) retitled this revision from Fix: Crash entering valid text into number field to Fix T87688: Crash entering valid text into number field.Apr 22 2021, 7:00 PM
  • Fix else-after-return
Falk David (filedescriptor) marked an inline comment as done.Apr 22 2021, 7:02 PM