Page MenuHome

Crash on undo after "Make Local"
Closed, ResolvedPublicBUG


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 -- (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

Event Timeline

Julian Eisel (Severin) changed the task status from Needs Triage to Confirmed.Jun 11 2020, 7:23 PM
Julian Eisel (Severin) triaged this task as High priority.
Julian Eisel (Severin) created this task.
Julian Eisel (Severin) changed the subtype of this task from "Report" to "Bug".

Can also recreate with 2.83.

Julian Eisel (Severin) updated the task description. (Show Details)

@Radu Popovici (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.

@Julian Eisel (Severin) 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...

@Bastien Montagne (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..