Page MenuHome

Crash when trying to delete particle system or undo CTRL+Z
Confirmed, NormalPublicBUG

Description

Blender Version
Broken: version: 2.82 (sub 7), branch: master, commit date: 2020-03-12 05:06, hash: rB375c7dc4caf4
Worked: 2.79

Short description of error
After updating from 2.79 to 2.8 this file file crashes when I try to delete the Plane. When I go to Edit mode, trying to rotate, grab or do anything it crashes. Plane has a particle system on it. When i try to delete it crashes too. Basically if i touch the Plane in any way it will crash and there is no way to get rid off it. Cannot delete the particle system either. Also, when i try to undo the last step CTRL it also makes it crash.

Exact steps for others to reproduce the error

  • Open the attached file
  • Try to delete the plane or its particle system

Crash.

Event Timeline

Germano Cavalcante (mano-wii) changed the task status from Needs Triage to Needs Information from User.Tue, Mar 17, 2:59 PM

Something is wrong with the attached file.
Please submit again.

I chaned in 'Get info' read and write to 'Everyone'. Is that what you meant? Sorry, this is the first time I'm submitting

Ankit (ankitm) changed the task status from Needs Information from User to Confirmed.EditedThu, Mar 19, 9:39 AM
Couldn't unmap memory
Blender(1776,0x11c3135c0) malloc: *** error for object 0x600003c82060: pointer being freed was not allocated
Blender(1776,0x11c3135c0) malloc: *** set a breakpoint in malloc_error_break to debug
(lldb)
#5	 in MEM_lockfree_freeN at blender/intern/guardedalloc/intern/mallocn_lockfree_impl.c:157
#6	 in free_hair at blender/source/blender/blenkernel/intern/particle.c:578
#7	 in psys_free at blender/source/blender/blenkernel/intern/particle.c:738
#8	 in BKE_object_free_particlesystems at blender/source/blender/blenkernel/intern/object.c:403
#9	 in BKE_object_free_modifiers at blender/source/blender/blenkernel/intern/object.c:439
#10	 in object_free_data at blender/source/blender/blenkernel/intern/object.c:279
#11	 in BKE_libblock_free_datablock at blender/source/blender/blenkernel/intern/lib_id_delete.c:132
#12	 in DEG::deg_free_copy_on_write_datablock(ID*) at blender/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc:1071
#13	 in DEG::(anonymous namespace)::free_copy_on_write_datablock(void*) at blender/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc:126
#14	 in ghash_free_cb at blender/source/blender/blenlib/intern/BLI_ghash.c:652
#15	 in BLI_ghash_free at blender/source/blender/blenlib/intern/BLI_ghash.c:1025
#16	 in DEG::DepsgraphNodeBuilder::~DepsgraphNodeBuilder() at blender/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc:155
#17	 in DEG::DepsgraphNodeBuilder::~DepsgraphNodeBuilder() at blender/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc:153
#18	 in ::DEG_graph_build_from_view_layer(Depsgraph *, Main *, Scene *, ViewLayer *) at blender/source/blender/depsgraph/intern/depsgraph_build.cc:261
#19	 in ::DEG_graph_relations_update(Depsgraph *, Main *, Scene *, ViewLayer *) at blender/source/blender/depsgraph/intern/depsgraph_build.cc:499
#20	 in scene_graph_update_tagged at blender/source/blender/blenkernel/intern/scene.c:1306
#21	 in BKE_scene_graph_update_tagged at blender/source/blender/blenkernel/intern/scene.c:1353
#22	 in wm_event_do_depsgraph at blender/source/blender/windowmanager/intern/wm_event_system.c:359
#23	 in wm_event_do_refresh_wm_and_depsgraph at blender/source/blender/windowmanager/intern/wm_event_system.c:385
#24	 in wm_event_do_notifiers at blender/source/blender/windowmanager/intern/wm_event_system.c:550
#25	 in WM_main at blender/source/blender/windowmanager/intern/wm.c:450
#26	 in main at blender/source/creator/creator.c:522

I copied the contents in a 2.83 empty file & even things like changing visibility of plane crashes it.

Germano Cavalcante (mano-wii) changed the subtype of this task from "Report" to "Bug".Thu, Mar 19, 12:34 PM

Ok, so the issue here is that the particles have hair data, even though though they are not hair particles.

When the COW copy is made by the depsgraph, it will make a shallow copy of the particle_data->hair pointer. If the particle system type would be Hair, it would make deep copies of the hair data for every particle. Now, when the particle system is removed, it will remove the hair data on the original object and on the cow object. Since both are pointing to the same hair data, there is a double free.

Possible solutions:

  • Change psys_copy_particles so that it either always copies the hair data, or sets the hair data to null on every particle.
  • Fix the .blend file in readfile.c. Doing that is a bit tricky, because the particle type is not known during direct linking afaik. So, it would have to be done during/after library linking.
  • Fix the .blend file in versioning. This does not solve the issue when it is created in new files. This only makes sense when we figure out why the hair data exists per particle in the first place.

I couldn't figure out where this incorrect particle state comes from, yet. I was not able to reproduce it from scratch in a new file.

@juan (kokotek) @Ankit (ankitm), is one of you able to reproduce the issue in a new file, without copying anything from another file?

is one of you able to reproduce the issue in a new file, without copying anything from another file?

If it's just adding a plane and applying a particle modifier to it, then no. I can move it around, change its visibility, get nice bubbles out of it, make it hair, back to emitter etc.

Also, it will crash if you open the file, click in viewport, attempt to close it and pick "don't save" . Though that can be the undo step as said in the report.