Crash on undo after "Make Local" #77774

Closed
opened 2020-06-11 19:23:02 +02:00 by Julian Eisel · 13 comments
Member

System Information
Operating system: Darwin-19.5.0-x86_64-i386-64bit 64 Bits
Graphics card: AMD Radeon Pro 5500M OpenGL Engine ATI Technologies Inc. 4.1 ATI-3.9.15

Blender Version
Broken: version: 2.83, 2.90.0 Alpha

Short description of error
Executing undo after running "Make Local" crashes.

Exact steps for others to reproduce the error

  • Open make_local_undo_crash.blend -- (ignore missing libraries warning, this doesn't seem to have an affect)
  • Select empty at center (so there's something to undo)
  • Call Make Local
  • Undo

bpy.ops.object.make_local(type='SELECT_OBJECT')  # Operator

# backtrace
0   Blender                             0x0000000113dd6204 BLI_system_backtrace + 52
1   Blender                             0x000000010aa44708 sig_handle_crash_backtrace + 40
2   Blender                             0x000000010aa444ee sig_handle_crash + 638
3   libsystem_platform.dylib            0x00007fff727ee5fd _sigtramp + 29
4   ???                                 0x00000100e53033a8 0x0 + 1103356769192
5   Blender                             0x000000010acf5eb2 BKE_scene_set_background + 162
6   Blender                             0x000000010aaa7a75 setup_app_data + 2629
7   Blender                             0x000000010aaa5d93 setup_app_blend_file_data + 115
8   Blender                             0x000000010aaa604e BKE_blendfile_read_from_memfile + 478
9   Blender                             0x000000010aaa568a BKE_memfile_undo_decode + 330
10  Blender                             0x000000010bbef97c memfile_undosys_step_decode + 476
11  Blender                             0x000000010ad82f42 undosys_step_decode + 578
12  Blender                             0x000000010ad82c96 BKE_undosys_step_undo_with_data_ex + 918
13  Blender                             0x000000010ad8300a BKE_undosys_step_undo_with_data + 42
14  Blender                             0x000000010ad83045 BKE_undosys_step_undo + 37
15  Blender                             0x000000010bbef0c2 ed_undo_step_impl + 1058
16  Blender                             0x000000010bbed23f ed_undo_step_direction + 47
17  Blender                             0x000000010bbed767 ed_undo_exec + 55
18  Blender                             0x000000010afb62b0 wm_operator_invoke + 976
19  Blender                             0x000000010afb8af1 wm_handler_operator_call + 1521
20  Blender                             0x000000010afb7650 wm_handlers_do_keymap_with_keymap_handler + 416
21  Blender                             0x000000010afb6f2d wm_handlers_do_intern + 461
22  Blender                             0x000000010afb0168 wm_handlers_do + 40
23  Blender                             0x000000010afafc3f wm_event_do_handlers + 3327
24  Blender                             0x000000010afa6347 WM_main + 39
25  Blender                             0x000000010aa3f7e4 main + 1028
26  libdyld.dylib                       0x00007fff725f5cc9 start + 1

**System Information** Operating system: Darwin-19.5.0-x86_64-i386-64bit 64 Bits Graphics card: AMD Radeon Pro 5500M OpenGL Engine ATI Technologies Inc. 4.1 ATI-3.9.15 **Blender Version** Broken: version: 2.83, 2.90.0 Alpha **Short description of error** Executing undo after running "Make Local" crashes. **Exact steps for others to reproduce the error** * Open [make_local_undo_crash.blend](https://archive.blender.org/developer/F8608845/make_local_undo_crash.blend) -- *(ignore missing libraries warning, this doesn't seem to have an affect)* * Select empty at center (so there's something to undo) * Call *Make Local* * Undo --- ```lines=12 bpy.ops.object.make_local(type='SELECT_OBJECT') # Operator # backtrace 0 Blender 0x0000000113dd6204 BLI_system_backtrace + 52 1 Blender 0x000000010aa44708 sig_handle_crash_backtrace + 40 2 Blender 0x000000010aa444ee sig_handle_crash + 638 3 libsystem_platform.dylib 0x00007fff727ee5fd _sigtramp + 29 4 ??? 0x00000100e53033a8 0x0 + 1103356769192 5 Blender 0x000000010acf5eb2 BKE_scene_set_background + 162 6 Blender 0x000000010aaa7a75 setup_app_data + 2629 7 Blender 0x000000010aaa5d93 setup_app_blend_file_data + 115 8 Blender 0x000000010aaa604e BKE_blendfile_read_from_memfile + 478 9 Blender 0x000000010aaa568a BKE_memfile_undo_decode + 330 10 Blender 0x000000010bbef97c memfile_undosys_step_decode + 476 11 Blender 0x000000010ad82f42 undosys_step_decode + 578 12 Blender 0x000000010ad82c96 BKE_undosys_step_undo_with_data_ex + 918 13 Blender 0x000000010ad8300a BKE_undosys_step_undo_with_data + 42 14 Blender 0x000000010ad83045 BKE_undosys_step_undo + 37 15 Blender 0x000000010bbef0c2 ed_undo_step_impl + 1058 16 Blender 0x000000010bbed23f ed_undo_step_direction + 47 17 Blender 0x000000010bbed767 ed_undo_exec + 55 18 Blender 0x000000010afb62b0 wm_operator_invoke + 976 19 Blender 0x000000010afb8af1 wm_handler_operator_call + 1521 20 Blender 0x000000010afb7650 wm_handlers_do_keymap_with_keymap_handler + 416 21 Blender 0x000000010afb6f2d wm_handlers_do_intern + 461 22 Blender 0x000000010afb0168 wm_handlers_do + 40 23 Blender 0x000000010afafc3f wm_event_do_handlers + 3327 24 Blender 0x000000010afa6347 WM_main + 39 25 Blender 0x000000010aa3f7e4 main + 1028 26 libdyld.dylib 0x00007fff725f5cc9 start + 1 ```
Author
Member

Added subscriber: @JulianEisel

Added subscriber: @JulianEisel
Bastien Montagne was assigned by Julian Eisel 2020-06-11 19:24:56 +02:00
Author
Member

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

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

Can also recreate with 2.83.

Can also recreate with 2.83.

Added subscriber: @rpopovici

Added subscriber: @rpopovici

Probably related to #77557

Probably related to #77557

@rpopovici it has nothing to do with that other task, which as already told you is not a bug at all in blender itself, but in your py operator code. The Make Local operator on the other hand, does properly generate expected undo steps.

@JulianEisel This actually a nice issue due to too much optimization...

  • Making an ID local just reuse the linked one whenever possible, instead of actually making a copy of it.
  • Therefore, the collection containing that ID is seen as unchanged, since the pointer itself remained the same.
  • But on undo step, there is no way to reuse that local object, which then gets deleted, and linked one gets re-created - at a different address.
  • Collection, however, since unchanged, is not updated at all and thus keep reference to the to-be-deleted local object, instead of the linked one.
  • Issue gets even worse with viewlayers, this leads to the crash.

Think the only easy way to fix that is to tag as changed collections affected by objects made local (and not only collections actually, while probably not crashing, this can also give issues with any other IDs referencing the made local ones). And we also likely want to re-generate the session uuid when making an ID local, actually...

@rpopovici it has nothing to do with that other task, which as already told you is not a bug at all in blender itself, but in your py operator code. The Make Local operator on the other hand, does properly generate expected undo steps. @JulianEisel This actually a nice issue due to too much optimization... * Making an ID local just reuse the linked one whenever possible, instead of actually making a copy of it. * Therefore, the collection containing that ID is seen as unchanged, since the pointer itself remained the same. * But on undo step, there is no way to reuse that local object, which then gets deleted, and linked one gets re-created - at a different address. * Collection, however, since unchanged, is not updated at all and thus keep reference to the to-be-deleted local object, instead of the linked one. * Issue gets even worse with viewlayers, this leads to the crash. Think the only easy way to fix that is to tag as changed collections affected by objects made local (and not only collections actually, while probably not crashing, this can also give issues with any other IDs referencing the made local ones). And we also likely want to re-generate the session uuid when making an ID local, actually...

@mont29 ..and I told you that the bug has nothing to do with my script. It's related to the fact that object linking/unlinking to the scene performed without cutting a new UNDO step crashed blender when ctrl+z is pressed. How is that related to my script? You can choose to return CANCELLED from a script or to remove the UNOD flag if you do not wish that behaviour in the first place, but that does not mean that you have to crash the app. Obviously blender doesn't have a strategy to handle these corner cases..

@mont29 ..and I told you that the bug has nothing to do with my script. It's related to the fact that object linking/unlinking to the scene performed without cutting a new UNDO step crashed blender when ctrl+z is pressed. How is that related to my script? You can choose to return CANCELLED from a script or to remove the UNOD flag if you do not wish that behaviour in the first place, but that does not mean that you have to crash the app. Obviously blender doesn't have a strategy to handle these corner cases..

Proposed patch in D8006

Proposed patch in [D8006](https://archive.blender.org/developer/D8006)

This issue was referenced by 91f07fbfd6

This issue was referenced by 91f07fbfd662ddb311d4dc459eab556db5936370

This issue was referenced by 554ed613ae

This issue was referenced by 554ed613ae5f26b205f65ed950ae50baf9f009b5

This issue was referenced by df1ff76ee2

This issue was referenced by df1ff76ee207f97fd274f3400c305e1fd8c19f19

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'

This issue was referenced by 6e13cff487

This issue was referenced by 6e13cff487117e621138ffb5531d7866b61d5865
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
4 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#77774
No description provided.