Maniphest T37559

Blender crashes when dissolving vertices in some situations
Closed, Resolved

Assigned To
Campbell Barton (campbellbarton)
Authored By
Voyager Voyager (voyagercgi)
Nov 21 2013, 1:49 AM
Tags
  • BF Blender
  • Modeling
Subscribers
Campbell Barton (campbellbarton)
Howard Trickey (howardt)
Voyager Voyager (voyagercgi)

Description

System Information
Windows 7, 64bit, GeForce GT 555M

Blender Version
Broken: Blender 2.69 r60995
Worked: Blender 2.69 r61240

Short description of error
Blender crashes in some unexpected situations

Exact steps for others to reproduce the error
Open the attached file and

  • click X then Dissolve Vertices - crash (not always)

if not then

  • pan and rotate view then click X then Dissolve - crash (not always)

I've encountered that it's possible to avoid crash in first situation. Open the file and before dissolving rotate/pan view. It helps in some situations. Vertices leading to crash are red marked.
On the Grease Pencil panel there is second, green marked layer. Try to dissolve marked vertices one by one (order of dissolving is not important). To make things more complicated it works in r60995 and is broken in r61240.

Revisions and Commits

rB Blender
rBAC Blender Add-ons Contrib

Event Timeline

Voyager Voyager (voyagercgi) created this task.Nov 21 2013, 1:49 AM
Voyager Voyager (voyagercgi) assigned this task to Howard Trickey (howardt).
Voyager Voyager (voyagercgi) raised the priority of this task from to 90.
Voyager Voyager (voyagercgi) updated the task description.
Voyager Voyager (voyagercgi) added projects: BF Blender, Modeling.
Voyager Voyager (voyagercgi) edited a custom field.
Voyager Voyager (voyagercgi) added a subscriber: Voyager Voyager (voyagercgi).
Howard Trickey (howardt) added a comment.Nov 21 2013, 3:50 AM

I wasn't able to reproduce. Sounds like it is something like uninitialized variables; I'll try with a memory debugger tomorrow.

Voyager Voyager (voyagercgi) added a comment.Nov 21 2013, 3:42 PM

I've confirmed the bug on another machine. Below is the link to show the steps when Blender doesn't crash immediately. After rotating/panning the view Blender crashes.
https://vimeo.com/79977071

Howard Trickey (howardt) reassigned this task from Howard Trickey (howardt) to Unknown Object (User).Nov 21 2013, 4:13 PM
Howard Trickey (howardt) added a subscriber: Howard Trickey (howardt).

I still had a hard time recreating this.
When I ran with valgrind, on linux, I eventually provoked some problems, but it was doing more than your video. I think I deselected all the verts, then selected them again, then dissolved.

The valgrind problem was then in the undo pushing code (after a couple of double frees, which may or may not be relevant):

read blend: bugdissolve.blend
BLI_assert failed: blender/source/blender/blenlib/intern/BLI_mempool.c:359, BLI_mempool_free(), at 'newhead->freeword != ( (int)('e') << 24 | (int)('e') << 16 | ('r') << 8 | ('f') )'
BLI_assert failed: blender/source/blender/blenlib/intern/BLI_mempool.c:359, BLI_mempool_free(), at 'newhead->freeword != ( (int)('e') << 24 | (int)('e') << 16 | ('r') << 8 | ('f') )'
Invalid write of size 4

  at 0x213FA92: copy_v3_v3 (math_vector_inline.c:66)
  by 0x2143538: BM_mesh_bm_to_me (bmesh_mesh_conv.c:655)
  by 0x1C85948: editbtMesh_to_undoMesh (editmesh_utils.c:522)
  by 0x1B1E649: undo_editmode_push (editmode_undo.c:165)
  by 0x1C85C0D: undo_push_mesh (editmesh_utils.c:579)
  by 0x1B1FC0C: ED_undo_push (undo.c:94)
  by 0x1B201AB: ED_undo_push_op (undo.c:227)
  by 0x19444D3: wm_operator_finished (wm_event_system.c:659)
  by 0x1945440: wm_operator_invoke (wm_event_system.c:1031)
  by 0x19458D0: wm_operator_call_internal (wm_event_system.c:1185)
  by 0x1945A88: WM_operator_name_call (wm_event_system.c:1234)
  by 0x1BF5C84: ui_apply_but_funcs_after (interface_handlers.c:521)
Address 0x1b408040 is 0 bytes after a block of size 208 alloc'd
  at 0x7C11DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
  by 0x27791E0: MEM_lockfree_callocN (mallocn_lockfree_impl.c:220)
  by 0x2142865: BM_mesh_bm_to_me (bmesh_mesh_conv.c:598)
  by 0x1C85948: editbtMesh_to_undoMesh (editmesh_utils.c:522)
  by 0x1B1E649: undo_editmode_push (editmode_undo.c:165)
  by 0x1C85C0D: undo_push_mesh (editmesh_utils.c:579)
  by 0x1B1FC0C: ED_undo_push (undo.c:94)
  by 0x1B201AB: ED_undo_push_op (undo.c:227)
  by 0x19444D3: wm_operator_finished (wm_event_system.c:659)
  by 0x1945440: wm_operator_invoke (wm_event_system.c:1031)
  by 0x19458D0: wm_operator_call_internal (wm_event_system.c:1185)
  by 0x1945A88: WM_operator_name_call (wm_event_system.c:1234)

Line numbers are from build at commit rB1158c1f7c0ec ; the line
in BM_mesh_bm_to_me() is first line in the loop over BM_VERTS_OF_MESH
in that function.
This looks like the BM_bmesh_bm_to_me code, while iterating over the BM_VERTS_OF_MESH,
is perhaps going too far (past the vertices just dissolved?).

I could try to look at this more but maybe Campbell knows this code better and has a better idea of
what might be going on here, so I'm reassigning to him. (Hope that's OK, Campbell.)

Campbell Barton (campbellbarton) edited this Maniphest Task.Nov 22 2013, 9:44 AM
Campbell Barton (campbellbarton) changed the task status from Unknown Status to Resolved.Nov 22 2013, 9:44 AM

Closed by commit rB283f43d31a60.

Campbell Barton (campbellbarton) added a subscriber: Campbell Barton (campbellbarton).Nov 22 2013, 9:51 AM

The problem is (afaics) that dissolve is removing vertices other then the one we're looping over.

I checked on having the ability to tell dissolve only to remove the vertex passed, this may still be useful to do, but it isnt so simple since dissolve handles so many cases.

It turns out that simply not using BM_ITER_MESH_MUTABLE fixes this (which is my bad! - since BM_ITER_MESH_MUTABLE only handles removing the data thats being looped on).

Brecht Van Lommel (brecht) reassigned this task from Unknown Object (User) to Campbell Barton (campbellbarton).Nov 25 2013, 5:58 PM
Campbell Barton (campbellbarton) edited this Maniphest Task.May 12 2014, 4:30 PM