Page MenuHome

Crash when converting objects from Curve to Mesh
Closed, ResolvedPublicBUG

Description

System Information
Operating system: macOS and Manjaro Linux
Graphics card: Radeon M395 and GTX 1080

Blender Version
Broken: Latest buildbot build on macOS (July 9 2019) and master from a view days ago that I compiled on Linux.

Short description of error
Using a short script to convert a bunch of curves to meshes it turned out that just a few of them caused a crash.

It looks like BKE_mesh_new_from_object is returning NULL in the function BKE_mesh_new_from_object_to_bmain.

Exact steps for others to reproduce the error

  1. Open the file and press Run Script. All the curve objects in the scene should already be selected.
  2. Crash (Segfault)

Backtrace

#0  0x00005555575a64de in BLI_strnlen (s=0x22 <error: Cannot access memory at address 0x22>, maxlen=63)
    at /home/hans/Documents/Blender-Git/blender/source/blender/blenlib/intern/string.c:780
#1  0x00005555575a514b in BLI_strncpy (dst=0x7fffffffbf10 "`e\255[UU", src=0x22 <error: Cannot access memory at address 0x22>, maxncpy=64)
    at /home/hans/Documents/Blender-Git/blender/source/blender/blenlib/intern/string.c:108
#2  0x000055555730a767 in BKE_id_new_name_validate (lb=0x7fffa82d4980, id=0x7fffbaee9108, tname=0x22 <error: Cannot access memory at address 0x22>)
    at /home/hans/Documents/Blender-Git/blender/source/blender/blenkernel/intern/library.c:1713
#3  0x0000555557309524 in BKE_libblock_alloc (bmain=0x7fffa82d4508, type=17741, name=0x22 <error: Cannot access memory at address 0x22>, flag=0)
    at /home/hans/Documents/Blender-Git/blender/source/blender/blenkernel/intern/library.c:1233
#4  0x0000555557339ba0 in BKE_mesh_add (bmain=0x7fffa82d4508, name=0x22 <error: Cannot access memory at address 0x22>)
    at /home/hans/Documents/Blender-Git/blender/source/blender/blenkernel/intern/mesh.c:534
#5  0x0000555557341f1f in BKE_mesh_new_from_object_to_bmain (bmain=0x7fffa82d4508, depsgraph=0x7fffbd7b4748, object=0x7fffa447dc08, preserve_all_data_layers=true)
    at /home/hans/Documents/Blender-Git/blender/source/blender/blenkernel/intern/mesh_convert.c:1235
#6  0x0000555557fc537a in curvetomesh (bmain=0x7fffa82d4508, depsgraph=0x7fffbd7b4748, ob=0x7fffbd904a08)
    at /home/hans/Documents/Blender-Git/blender/source/blender/editors/object/object_add.c:2039
#7  0x0000555557fc63b3 in convert_exec (C=0x7fffec460108, op=0x7fffa75878c8) at /home/hans/Documents/Blender-Git/blender/source/blender/editors/object/object_add.c:2371
#8  0x00005555578b1d1c in wm_operator_invoke (C=0x7fffec460108, ot=0x7fffe271e608, event=0x0, properties=0x7fffffffc450, reports=0x7fffa1bc8f18, poll_only=false, 
    use_last_properties=true) at /home/hans/Documents/Blender-Git/blender/source/blender/windowmanager/intern/wm_event_system.c:1450
#9  0x00005555578b2522 in wm_operator_call_internal (C=0x7fffec460108, ot=0x7fffe271e608, properties=0x7fffffffc450, reports=0x7fffa1bc8f18, context=6, poll_only=false, event=0x0)
    at /home/hans/Documents/Blender-Git/blender/source/blender/windowmanager/intern/wm_event_system.c:1685
#10 0x00005555578b27f9 in WM_operator_call_py (C=0x7fffec460108, ot=0x7fffe271e608, context=6, properties=0x7fffffffc450, reports=0x7fffa1bc8f18, is_undo=false)
    at /home/hans/Documents/Blender-Git/blender/source/blender/windowmanager/intern/wm_event_system.c:1785
#11 0x0000555557672cc7 in pyop_call (UNUSED_self=0x7fffc1e94728, args=0x7fffbbac5630) at /home/hans/Documents/Blender-Git/blender/source/blender/python/intern/bpy_operator.c:267
#12 0x00007ffff7779252 in _PyMethodDef_RawFastCallKeywords () from /usr/lib/libpython3.7m.so.1.0
#13 0x00007ffff7779394 in _PyCFunction_FastCallKeywords () from /usr/lib/libpython3.7m.so.1.0
#14 0x00007ffff77b1d4c in ?? () from /usr/lib/libpython3.7m.so.1.0
#15 0x00007ffff77eeef7 in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.7m.so.1.0
#16 0x00007ffff779dd18 in _PyEval_EvalCodeWithName () from /usr/lib/libpython3.7m.so.1.0
#17 0x00007ffff779f44f in _PyFunction_FastCallDict () from /usr/lib/libpython3.7m.so.1.0
#18 0x00007ffff776d3d8 in _PyObject_Call_Prepend () from /usr/lib/libpython3.7m.so.1.0
#19 0x00007ffff77acbba in ?? () from /usr/lib/libpython3.7m.so.1.0
#20 0x00007ffff77b0aac in _PyObject_FastCallKeywords () from /usr/lib/libpython3.7m.so.1.0
#21 0x00007ffff77b1dc2 in ?? () from /usr/lib/libpython3.7m.so.1.0
#22 0x00007ffff77efb96 in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.7m.so.1.0
#23 0x00007ffff779dd18 in _PyEval_EvalCodeWithName () from /usr/lib/libpython3.7m.so.1.0
#24 0x00007ffff779eaca in PyEval_EvalCodeEx () from /usr/lib/libpython3.7m.so.1.0
#25 0x00007ffff779eaec in PyEval_EvalCode () from /usr/lib/libpython3.7m.so.1.0
#26 0x0000555557653554 in python_script_exec (C=0x7fffec460108, fn=0x0, text=0x7fffbb110b08, reports=0x7fffa22543c8, do_jump=true)
    at /home/hans/Documents/Blender-Git/blender/source/blender/python/intern/bpy_interface.c:476
#27 0x000055555765386b in BPY_execute_text (C=0x7fffec460108, text=0x7fffbb110b08, reports=0x7fffa22543c8, do_jump=true)
    at /home/hans/Documents/Blender-Git/blender/source/blender/python/intern/bpy_interface.c:569
#28 0x00005555583bc7fd in text_run_script (C=0x7fffec460108, reports=0x7fffa22543c8) at /home/hans/Documents/Blender-Git/blender/source/blender/editors/space_text/text_ops.c:708
#29 0x00005555583bc8d2 in text_run_script_exec (C=0x7fffec460108, op=0x7fffa7587448) at /home/hans/Documents/Blender-Git/blender/source/blender/editors/space_text/text_ops.c:747
#30 0x00005555578b1d1c in wm_operator_invoke (C=0x7fffec460108, ot=0x7fffe284f288, event=0x7fffe28ebf88, properties=0x7fffffffd250, reports=0x0, poll_only=false, 
    use_last_properties=true) at /home/hans/Documents/Blender-Git/blender/source/blender/windowmanager/intern/wm_event_system.c:1450
#31 0x00005555578b23bc in wm_operator_call_internal (C=0x7fffec460108, ot=0x7fffe284f288, properties=0x7fffffffd250, reports=0x0, context=1, poll_only=false, event=0x7fffe28ebf88)
    at /home/hans/Documents/Blender-Git/blender/source/blender/windowmanager/intern/wm_event_system.c:1651
#32 0x00005555578b25df in WM_operator_name_call_ptr (C=0x7fffec460108, ot=0x7fffe284f288, context=1, properties=0x7fffffffd250)
    at /home/hans/Documents/Blender-Git/blender/source/blender/windowmanager/intern/wm_event_system.c:1699
#33 0x0000555557d731da in ui_apply_but_funcs_after (C=0x7fffec460108) at /home/hans/Documents/Blender-Git/blender/source/blender/editors/interface/interface_handlers.c:831
#34 0x0000555557d8d672 in ui_handler_region_menu (C=0x7fffec460108, event=0x7fffcb615488, UNUSED_userdata=0x7fffbb107188)
    at /home/hans/Documents/Blender-Git/blender/source/blender/editors/interface/interface_handlers.c:10498
#35 0x00005555578af895 in wm_handler_ui_call (C=0x7fffec460108, handler=0x7fff9eace808, event=0x7fffcb615488, always_pass=0)
    at /home/hans/Documents/Blender-Git/blender/source/blender/windowmanager/intern/wm_event_system.c:623
#36 0x00005555578b4c86 in wm_handlers_do_intern (C=0x7fffec460108, event=0x7fffcb615488, handlers=0x7fffbb113318)
    at /home/hans/Documents/Blender-Git/blender/source/blender/windowmanager/intern/wm_event_system.c:2699
#37 0x00005555578b5a5f in wm_handlers_do (C=0x7fffec460108, event=0x7fffcb615488, handlers=0x7fffbb113318)
    at /home/hans/Documents/Blender-Git/blender/source/blender/windowmanager/intern/wm_event_system.c:2945
#38 0x00005555578b6bfe in wm_event_do_handlers (C=0x7fffec460108) at /home/hans/Documents/Blender-Git/blender/source/blender/windowmanager/intern/wm_event_system.c:3307
#39 0x00005555578a9cfa in WM_main (C=0x7fffec460108) at /home/hans/Documents/Blender-Git/blender/source/blender/windowmanager/intern/wm.c:417
#40 0x000055555720425d in main (argc=1, argv=0x7fffffffda08) at /home/hans/Documents/Blender-Git/blender/source/creator/creator.c:500

Event Timeline

Sybren A. Stüvel (sybren) lowered the priority of this task from 90 to High.

The script contains some mistakes (you shouldn't iterate over the collection of "selected objects" and then change the selection state; that changes the very collection you're iterating over). However, the crash also happens when you simply select Convert to → Mesh from the menu.

The root cause was that Blender is unable to convert a single-vertex curve to a mesh, but didn't handle the resulting NULL pointer. This is a minimal example that just contains that curve:

The script contains some mistakes (you shouldn't iterate over the collection of "selected objects" and then change the selection state; that changes the very collection you're iterating over). However, the crash also happens when you simply select Convert to → Mesh from the menu.

Oops! My bad! I was helping someone with that conversion the other day and I just quickly through together the script from the "Batch export" example.

Once again I'm super impressed by how fast you all deal with bugs, it's amazing! Thanks!