-
-
Notifications
You must be signed in to change notification settings - Fork 22k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix crash when inserting keyframes with empty properties array #99148
Conversation
Can you provide a video capture of the detailed reproduction procedure for #98751 first? Since the crash does not occur in my environment.
|
@TokageItLab I'm able to reproduce it on my end, GNU/Linux. And PR's code fixes it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic to check for empty properties to avoid the crash makes sense. Also, the crash has been confirmed. Thirdly, I don't see how it will break the code even if it's wrong, so the risk of merging is low and the benefit of fixing a crash is high.
Here's the video capture of the crash reported by #98751 replicated on my machine: Pre-change.mp4With the change in this PR the crash no longer occurs: Post-change.mp4I also added the requested formatting change |
Need to confirm that the 4.3 crash is related so unlocking the issue until we can confirm a dedicated 4.3 version fixes this as the code is different |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot reproduce the crash in my environment when I perform the same operation as in the video, so it may be an environment-dependent (Linux?) issue.
What I am concerned about is that this fix is not directly related to the animation, but is a check on the processing timing of the inspector plugin.
Considering that the inspector is displayed correctly after the fix, is it possible that the inspector plugin is being called multiple times and somewhere along the way null accesses are occurring? I think we need to take a closer look at why the property is missing there.
Well, as fire's comment says, it should be a safe change, so I think it's okay with merging it to prevent crashes for now.
a6a2b60
to
d1ba152
Compare
I think #98751 was wrongly flagged as being the issue this solves, though I need to see if I can reproduce it to confirm. This seems to be solving a very recent regression in |
Thanks! Congratulations on your first contribution! 🎉 |
Fix crash when inserting keyframes with empty properties array
Bugsquad edit:
Fixes (for 4.4) Crash when inserting rotation keyframe #98751 (Crash when inserting rotation keyframe)Doesn't seem to be the case, the issue just sounds related.
Description
When inserting rotation keyframes in the animation editor, clicking on the keyframe would cause the editor to crash due to an Array out-of-bound error. Upon further inspection using coredumpctl it seems to be crashing from a out-of-bounds index on editor_inspector.cpp:2727, with accessing
F.properties[0]
without checking if the properties array is empty could cause a crash. This is accessed to see if the property is in the favorites list. However, if an element such as AnimationTrackKeyEdit does not have any properties that can be favorited. This PR adds a safety check to prevent accessing an empty array.Modified Files
editor/editor_inspector.cpp
Changes
The following changes prevent the crash by adding an empty check before accessing the properties array:
Testing
Tested with the provided reproduction case:
Tested on:
Notes
The crash occurred because the properties array could be empty when attempting to insert certain types of keyframes in the animation editor. This fix ensures we check for empty arrays before accessing their elements, following proper array bounds checking practices.