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

Description

--- 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 = bm.verts.new((0, 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...

campbellbarton (Campbell Barton) added a comment.Via Old WorldJan 9 2013, 3:12 PM

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.
http://www.blender.org/documentation/blender_python_api_2_65_3/bmesh.html#bmesh.update_edit_mesh

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.

closing.

campbellbarton (Campbell Barton) closed this task as "Resolved".Via Old WorldFeb 12 2013, 12:06 PM

Add Comment