Page MenuHome

Blender hard crashes on accessing particle uv_on_emitter
Closed, ResolvedPublicBUG


System Information
Operating system: Windows-10-10.0.18362 64 Bits
Graphics card: GeForce GTX 1060 6GB/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 441.28

Blender Version
Broken: version: 2.81 (sub 16), branch: master, commit date: 2019-12-04 11:32, hash: rBf1aa4d18d49d
Worked: (optional)

Short description of error
uv_on_emitter access crashes Blender

Exact steps for others to reproduce the error
Open the attached file, and run the script.

Event Timeline

Doesn't look like you did anything wrong. The uv_on_emitter function seems to cause a segmentation fault. Here's the backtrace:

# Blender 2.81 (sub 16), Commit date: 2019-12-04 11:32, Hash f1aa4d18d49d

# backtrace
blender(BLI_system_backtrace+0x1d) [0x14ee84d]
blender() [0x12cbb79]
/lib/x86_64-linux-gnu/ [0x7fd0cfc894b0]
blender(CustomData_get_layer_index+0x3) [0x133c2c3]
blender(CustomData_has_layer+0x9) [0x133cb49]
blender() [0x163dfe0]
blender(RNA_function_call+0x12) [0x15a1742]
blender() [0x156ccca]
blender(_PyObject_FastCallKeywords+0x104) [0x18daaf4]
blender(_PyEval_EvalFrameDefault+0x2de5) [0x12c1d55]
blender(_PyEval_EvalCodeWithName+0xadc) [0x198c36c]
blender(PyEval_EvalCodeEx+0x3e) [0x198c49e]
blender(PyEval_EvalCode+0x1b) [0x198c4cb]
blender() [0x156330c]
blender() [0x3184a6e]
blender() [0x16a2f3b]
blender() [0x16a31a7]
blender(WM_operator_name_call_ptr+0x1a) [0x16a35aa]
blender() [0x2dde7a2]
blender() [0x2deda55]
blender() [0x16a5de3]
blender() [0x16a7e9c]
blender(wm_event_do_handlers+0x312) [0x16a8572]
blender(WM_main+0x20) [0x169dcd0]
blender(main+0x2fe) [0x1237f7e]
/lib/x86_64-linux-gnu/ [0x7fd0cfc74830]
blender() [0x12c849c]
Germano Cavalcante (mano-wii) changed the task status from Needs Triage to Confirmed.Wed, Jan 15, 6:28 PM
Germano Cavalcante (mano-wii) triaged this task as Low priority.
Germano Cavalcante (mano-wii) changed the subtype of this task from "Report" to "Bug".

I can confirm.
The crash happens because, in C, modifier->mesh_final it is NULL.
Apparently this only happens when the modifier is obtained through an unevaluated (original) object.
Which in this case was in this line:

source_mod = source_ob.modifiers[0]

Rewriting the script like this allows you to get the modifiers of the evaluated object, thus avoiding the crash.

import bpy

depsgraph = bpy.context.view_layer.depsgraph
source_ob_orig = bpy.context.selected_objects[0]
source_ob_eval = depsgraph.id_eval_get(source_ob_orig)

source_psys = source_ob_eval.particle_systems[0]
print(, len(source_psys.particles))
source_mod = source_ob_eval.modifiers[0]

for prt in source_psys.particles:

But a crash should never happen. So I wonder if source_ob_eval.modifiers[0] should be allowed for original objects.

Thank you guys! I'll use the evaluated object instead. Glad that it's still flagged to fix the crashing result.