Crash when selecting Bone #83293

Closed
opened 2020-12-01 19:48:38 +01:00 by Julian Mohr · 18 comments

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: GeForce GTX 1060 6GB/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 457.30

Blender Version
Broken: version: 2.92.0 Alpha, branch: master, commit date: 2020-12-01 09:45, hash: 01b94c5d8a
Worked: Prior to e922dd7d8a

Short description of error
Blender crashes when Bone is selected.

Exact steps for others to reproduce the error

bonetest.blend
It will not crash if another operation is done like circle select etc.

**System Information** Operating system: Windows-10-10.0.19041-SP0 64 Bits Graphics card: GeForce GTX 1060 6GB/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 457.30 **Blender Version** Broken: version: 2.92.0 Alpha, branch: master, commit date: 2020-12-01 09:45, hash: `01b94c5d8a` Worked: Prior to e922dd7d8a **Short description of error** Blender crashes when Bone is selected. **Exact steps for others to reproduce the error** - Open Blender with the default startup scene - Add armature - Enter edit mode - Select bone [2020-12-01 19-47-05.mp4](https://archive.blender.org/developer/F9420879/2020-12-01_19-47-05.mp4) [bonetest.blend](https://archive.blender.org/developer/F9420859/bonetest.blend) It will not crash if another operation is done like circle select etc.
Author

Added subscriber: @Jewls

Added subscriber: @Jewls
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

Added subscriber: @EitanSomething

Added subscriber: @EitanSomething
Member

I can confirm this crash in 2.92.0 Alpha, branch: master, commit date: 2020-11-30 18:56, hash: 007a0e43a0

blender_debug_output.txt

I can confirm this crash in 2.92.0 Alpha, branch: master, commit date: 2020-11-30 18:56, hash: `007a0e43a0` [blender_debug_output.txt](https://archive.blender.org/developer/F9421068/blender_debug_output.txt)

Added subscribers: @JacquesLucke, @rjg

Added subscribers: @JacquesLucke, @rjg

@JacquesLucke It appears that this issue was introduced by commit e922dd7d8a

@JacquesLucke It appears that this issue was introduced by commit e922dd7d8a
Member

The video looks quite bad. Unfortunately, I can't seem to be able to reproduce it.
@rjg If you can still reproduce it, can you try undoing the change Clement commented about in D9640?

2020-12-02 10-51-03.mp4

The video looks quite bad. Unfortunately, I can't seem to be able to reproduce it. @rjg If you can still reproduce it, can you try undoing the change Clement commented about in [D9640](https://archive.blender.org/developer/D9640)? [2020-12-02 10-51-03.mp4](https://archive.blender.org/developer/F9424003/2020-12-02_10-51-03.mp4)

@JacquesLucke I will check shortly.

@JacquesLucke I will check shortly.

@JacquesLucke Undoing the change avoids the crash.

@JacquesLucke Undoing the change avoids the crash.
Member

Do you have any idea for what I'm doing wrong so that I can't reproduce it?

Can you give me a stack trace or ASAN report?

Do you have any idea for what I'm doing wrong so that I can't reproduce it? Can you give me a stack trace or ASAN report?

I don't see anything wrong with your steps in the video.

  • Add > Armature
  • Use {key Tab} to switch to edit mode

Click on the bone

I reproduced the crash on Windows with the following stack trace. base and ebone are NULL which triggers the assert.

_BLI_assert_abort() Line 51	C
get_nearest_editbonepoint(ViewContext * vc, bool findunsel, bool use_cycle, Base * * r_base, int * r_selmask) Line 790	C
ED_armature_edit_select_pick(bContext * C, const int * mval, bool extend, bool deselect, bool toggle) Line 983	C
view3d_select_exec(bContext * C, wmOperator * op) Line 2415	C
view3d_select_invoke(bContext * C, wmOperator * op, const wmEvent * event) Line 2508	C
wm_operator_invoke(bContext * C, wmOperatorType * ot, wmEvent * event, PointerRNA * properties, ReportList * reports, const bool poll_only, bool use_last_properties) Line 1296	C
wm_handler_operator_call(bContext * C, ListBase * handlers, wmEventHandler * handler_base, wmEvent * event, PointerRNA * properties, const unsigned char * kmi_idname) Line 2143	C
wm_handlers_do_keymap_with_keymap_handler(bContext * C, wmEvent * event, ListBase * handlers, wmEventHandler_Keymap * handler, wmKeyMap * keymap, const bool do_debug_handler) Line 2453	C
wm_handlers_do_intern(bContext * C, wmEvent * event, ListBase * handlers) Line 2750	C
wm_handlers_do(bContext * C, wmEvent * event, ListBase * handlers) Line 2959	C
wm_event_do_handlers(bContext * C) Line 3370	C
WM_main(bContext * C) Line 638	C
main(int argc, const unsigned char * * UNUSED_argv_c) Line 526	C

It's the same on Linux for me.

I don't see anything wrong with your steps in the video. - *Add > Armature* - Use {key Tab} to switch to edit mode # Click on the bone I reproduced the crash on Windows with the following stack trace. `base` and `ebone` are `NULL` which triggers the assert. ```lines _BLI_assert_abort() Line 51 C get_nearest_editbonepoint(ViewContext * vc, bool findunsel, bool use_cycle, Base * * r_base, int * r_selmask) Line 790 C ED_armature_edit_select_pick(bContext * C, const int * mval, bool extend, bool deselect, bool toggle) Line 983 C view3d_select_exec(bContext * C, wmOperator * op) Line 2415 C view3d_select_invoke(bContext * C, wmOperator * op, const wmEvent * event) Line 2508 C wm_operator_invoke(bContext * C, wmOperatorType * ot, wmEvent * event, PointerRNA * properties, ReportList * reports, const bool poll_only, bool use_last_properties) Line 1296 C wm_handler_operator_call(bContext * C, ListBase * handlers, wmEventHandler * handler_base, wmEvent * event, PointerRNA * properties, const unsigned char * kmi_idname) Line 2143 C wm_handlers_do_keymap_with_keymap_handler(bContext * C, wmEvent * event, ListBase * handlers, wmEventHandler_Keymap * handler, wmKeyMap * keymap, const bool do_debug_handler) Line 2453 C wm_handlers_do_intern(bContext * C, wmEvent * event, ListBase * handlers) Line 2750 C wm_handlers_do(bContext * C, wmEvent * event, ListBase * handlers) Line 2959 C wm_event_do_handlers(bContext * C) Line 3370 C WM_main(bContext * C) Line 638 C main(int argc, const unsigned char * * UNUSED_argv_c) Line 526 C ``` It's the same on Linux for me.
Author

@JacquesLucke the first click after entering edit mode must be on the bone. if you click somewhere else it wont be triggerd.

@JacquesLucke the first click after entering edit mode must be on the bone. if you click somewhere else it wont be triggerd.
Member

Added subscriber: @fclem

Added subscriber: @fclem
Member

Thanks. I'm able to reproduce it now.

The issue is that the armature is drawn in the FOREACH_OBJECT_IN_MODE_BEGIN in DRW_draw_select_loop. However, only the DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN sets the correct select_id on the cow object.
Here are two possible fixes. @fclem, can you decide what is better, or do you have a better fix?

  1. Make sure that the select_id is correct on the cow object.
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 988975bd399..d19b784f963 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -2380,6 +2380,8 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph,
 
     if (use_obedit) {
       FOREACH_OBJECT_IN_MODE_BEGIN (view_layer, v3d, object_type, object_mode, ob_iter) {
+        Object *ob_iter_orig = DEG_get_original_object(ob_iter);
+        ob_iter->runtime.select_id = ob_iter_orig->runtime.select_id;
         drw_engines_cache_populate(ob_iter);
       }
       FOREACH_OBJECT_IN_MODE_END;
  1. Revert the part of e922dd7d8a that introduces this error. I guess this should be fine for edit mode drawing, but I'm not sure...
diff --git a/source/blender/draw/engines/overlay/overlay_armature.c b/source/blender/draw/engines/overlay/overlay_armature.c
index 1f95eec4486..cbd2589f20f 100644
--- a/source/blender/draw/engines/overlay/overlay_armature.c
+++ b/source/blender/draw/engines/overlay/overlay_armature.c
@@ -1910,7 +1910,7 @@ static void draw_armature_edit(ArmatureDrawContext *ctx)
 
   edbo_compute_bbone_child(arm);
 
-  for (eBone = arm->edbo->first, index = ob->runtime.select_id; eBone;
+  for (eBone = arm->edbo->first, index = ob_orig->runtime.select_id; eBone;
        eBone = eBone->next, index += 0x10000) {
     if (eBone->layer & arm->layer) {
       if ((eBone->flag & BONE_HIDDEN_A) == 0) {
@@ -2005,7 +2005,8 @@ static void draw_armature_pose(ArmatureDrawContext *ctx)
         DRW_state_is_select();
 
     if (is_pose_select) {
-      index = ob->runtime.select_id;
+      const Object *ob_orig = DEG_get_original_object(ob);
+      index = ob_orig->runtime.select_id;
     }
   }
Thanks. I'm able to reproduce it now. The issue is that the armature is drawn in the `FOREACH_OBJECT_IN_MODE_BEGIN` in `DRW_draw_select_loop`. However, only the `DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN` sets the correct `select_id` on the cow object. Here are two possible fixes. @fclem, can you decide what is better, or do you have a better fix? 1. Make sure that the `select_id` is correct on the cow object. ``` diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 988975bd399..d19b784f963 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -2380,6 +2380,8 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph, if (use_obedit) { FOREACH_OBJECT_IN_MODE_BEGIN (view_layer, v3d, object_type, object_mode, ob_iter) { + Object *ob_iter_orig = DEG_get_original_object(ob_iter); + ob_iter->runtime.select_id = ob_iter_orig->runtime.select_id; drw_engines_cache_populate(ob_iter); } FOREACH_OBJECT_IN_MODE_END; ``` 2. Revert the part of e922dd7d8a that introduces this error. I guess this should be fine for edit mode drawing, but I'm not sure... ``` diff --git a/source/blender/draw/engines/overlay/overlay_armature.c b/source/blender/draw/engines/overlay/overlay_armature.c index 1f95eec4486..cbd2589f20f 100644 --- a/source/blender/draw/engines/overlay/overlay_armature.c +++ b/source/blender/draw/engines/overlay/overlay_armature.c @@ -1910,7 +1910,7 @@ static void draw_armature_edit(ArmatureDrawContext *ctx) edbo_compute_bbone_child(arm); - for (eBone = arm->edbo->first, index = ob->runtime.select_id; eBone; + for (eBone = arm->edbo->first, index = ob_orig->runtime.select_id; eBone; eBone = eBone->next, index += 0x10000) { if (eBone->layer & arm->layer) { if ((eBone->flag & BONE_HIDDEN_A) == 0) { @@ -2005,7 +2005,8 @@ static void draw_armature_pose(ArmatureDrawContext *ctx) DRW_state_is_select(); if (is_pose_select) { - index = ob->runtime.select_id; + const Object *ob_orig = DEG_get_original_object(ob); + index = ob_orig->runtime.select_id; } } ```

I would go for option number 2.

I would go for option number 2.
Member

Ok, I'll commit that then. Thanks.

Ok, I'll commit that then. Thanks.

This issue was referenced by 85f9d319a4

This issue was referenced by 85f9d319a409f26a4ca29d780de6a529794dc13e
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Jacques Lucke self-assigned this 2020-12-02 15:34:13 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
6 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#83293
No description provided.