Fastorigin addon crashes on mesh.update()
Closed, ResolvedPublic


--- Operating System, Graphics card ---
CPU AMD Phenom II X6 1045T 2.70Ghz
4 Gb RAM
ATI Radeon 5770
Windows 7 32bit

--- Blender version with error, and version that worked ---
crash tested on revision 53235 and 53454
no crash tested on official builds 2.65, 2.65a

--- Short description of error ---
My fastorigin addon (attached) which has worked for months now crashes Blender on line 238 : mesh.update()
The line causing mesh.update() to crash afterwards is line 236 : originvert =, 0, 0))
INFO : Bmesh structure created from_edit_mesh

--- Steps for others to reproduce the error (preferably based on attached .blend file) ---
Choose factory defaults (standard cube) and TAB into EDIT mode, then invoke addon --> crash!
Remark : when starting the addon from OBJECT mode, theres no crash, although the addon switches to EDIT mode from within the addon on lines 211 and 212...



Whats happening is the array used to cache verts/edges/faces gets out of sync with the bmesh.
The fix is to call bmesh.update_edit_mesh with destructive=True.

I had a look into making our API not crash in this case but its not so simple since the data to access isnt available to the BMesh, Ill leave open and check on this further.

When the mesh is freed (explicitly or through pythons garbage collection), a warning is now raised if update_edit_mesh() isnt called.

this doesnt stop the crash but points to correct api use to avoid crashing.