Page MenuHome

Crash undoing a removal of a lattice via python
Open, Confirmed, MediumPublic

Description

System Information
Operating system: Windows 10
Graphics card: Intel

Blender Version
blender-2.80.0-git.030c7df19da9-windows64

Short description of error

Blender crashes when undo is called if a lattice object is deleted in edit mode via an operator addon

Exact steps for others to reproduce the error

  • install the addon in the attachment (copy it to addons or as zip)
  • open the addon tab and search for "crasher"
  • enable it
  • open the violation.blend file that is in the addon folder (or from the zip file)
  • it should open in lattice (active) edit mode, if not select the lattice and toggle to edit mode
  • F3, search for simple operator
  • execute it
  • do not do anything else, just do undo (ctrl-z)

Blender will exit with

Error   : EXCEPTION_ACCESS_VIOLATION 
Address : 0x00007FF65A3BDF97

It seems like it is possible to avoid the crash only if the user does some other stuff like selecting moving other objects after firing the addon however this does not help with the addon context, not possible to avoid this as far as I can tell.

I originally thought that using bpy.data.objects.remove(l) was causing this however using the ops equivalent bpy.ops.object.delete(use_global=False) does the same ill affect.

Details

Type
Bug

Event Timeline

kursad k (kursadk) updated the task description. (Show Details)
kursad k (kursadk) added a comment.EditedJun 10 2019, 11:53 PM

Here is an strace of when it crashed, I got it under Winx64 10, MSYS. Probably not that useful

00007ff879060000
--- Process 2420 loaded C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\animation_nodes\nodes\number\c_utils.cp37-win_amd64.pyd at 00007ff879040000
--- Process 2420 loaded C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\animation_nodes\nodes\number\float_math.cp37-win_amd64.pyd at 00007ff879010000
--- Process 2420 loaded C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\animation_nodes\nodes\vector\vector_math.cp37-win_amd64.pyd at 00007ff878fe0000
--- Process 2420 loaded C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\animation_nodes\nodes\vector\c_utils.cp37-win_amd64.pyd at 00007ff878fc0000
--- Process 2420 loaded C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\animation_nodes\nodes\object\object_matrix_output.cp37-win_amd64.pyd at 00007ff878fa0000
--- Process 2420 loaded C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\animation_nodes\nodes\rotation\c_utils.cp37-win_amd64.pyd at 00007ff878f80000
--- Process 2420 loaded C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\animation_nodes\nodes\spline\c_utils.cp37-win_amd64.pyd at 00007ff878f60000
--- Process 2420 loaded C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\animation_nodes\nodes\spline\splines_from_edges_utils.cp37-win_amd64.pyd at 00007ff878f40000
--- Process 2420 loaded C:\Windows\System32\UIAutomationCore.dll at 00007ff89ef90000
--- Process 2420 loaded C:\Windows\System32\userenv.dll at 00007ff8b6130000
--- Process 2420 thread 9888 created
--- Process 2420 thread 212 created
--- Process 2420 loaded C:\Windows\System32\sxs.dll at 00007ff8b6bf0000
--- Process 2420 thread 9568 exited with status 0x0
--- Process 2420 thread 10296 exited with status 0x0
--- Process 2420 loaded C:\Windows\System32\oleacc.dll at 00007ff8a8780000
--- Process 2420 loaded C:\Windows\System32\twinapi.dll at 00007ff89d660000
--- Process 2420, exception c0000005 at 00007ff65a3bdf97
--- Process 2420 thread 9372 exited with status 0xff
--- Process 2420 thread 11124 exited with status 0xff
--- Process 2420 thread 9888 exited with status 0xff
--- Process 2420 thread 9320 exited with status 0xff
--- Process 2420 thread 11068 exited with status 0xff
--- Process 2420 thread 1240 exited with status 0xff
--- Process 2420 thread 11256 exited with status 0xff
--- Process 2420 thread 6224 exited with status 0xff
--- Process 2420 thread 2640 exited with status 0xff
--- Process 2420 thread 5556 exited with status 0xff
--- Process 2420 thread 9772 exited with status 0xff
--- Process 2420 thread 8436 exited with status 0xff
--- Process 2420 thread 2568 exited with status 0xff
--- Process 2420 thread 5480 exited with status 0xff
--- Process 2420 thread 9500 exited with status 0xff
--- Process 2420 thread 2376 exited with status 0xff
--- Process 2420 thread 10920 exited with status 0xff
--- Process 2420 thread 5708 exited with status 0xff
--- Process 2420 thread 212 exited with status 0xff
--- Process 2420 exited with status 0xff
Philipp Oeser (lichtwerk) lowered the priority of this task from Needs Triage by Developer to Confirmed, Medium.Jun 11 2019, 10:17 AM

Backtrace is a bit misleading [since this is reproducable without animation_nodes enabled], but can confirm, checking...
Deleting from the UI has a valid Lattice->editlatt in lattice_undosys_poll / editlatt_object_from_context whereas doing this from python doesnt...

Philipp Oeser (lichtwerk) renamed this task from Blender crashes with EXCEPTION_ACCESS_VIOLATION when undoing to Crash undoing a removal of a lattice via python.Jun 11 2019, 10:18 AM

@Philipp Oeser (lichtwerk)

Thanks for conforming the bug. Do you know a work around with the API so I can avoid the crash until this is fixed?

kursad k (kursadk) added a comment.EditedJun 14 2019, 8:10 PM

It seems like this bug not just affecting undo delete but also it crashes Blender after undoing lattice naming and other Lattice objct related operations

Okay, looks like the problem is with the undo system; if you manually exit editmode then push the understack, e.g.:

bpy.ops.object.editmode_toggle()
bpy.ops.ed.undo_push()

the crash won't happen.

I imagine this could be tricky to fix; it might be a good idea to prohibit python deletion of objects in editmode.

As far as I can tell the solution recommended by @Joseph Eagar (joeedh) works in this case. I will test it further but I was able to overcome the hard crashes I have been facing when ediitng the lattice in an operator.