Page MenuHome

Sculpt Dyntopo undo crash
Closed, ResolvedPublic


Blender Version
Broken: 2.8 2891fb645b9

Short description of error
When using undo after sculpting with any brush with dyntopo turned on, Blender crashes.

Event Timeline

I was digging into this a little today but couldn't quite determine how to fix the issue.

Here's an address-sanitizer dump of the crash:

It looks like sculpt_pbvh_clear() frees the Object's ob->sculpt->pbvh, but then then the draw_manager_* stuff still has a pointer to the freed pbvh and attempts to read from it.

Julien Kaspar (JulienKaspar) triaged this task as Confirmed, High priority.Jun 7 2018, 10:08 AM

The problem here is internally there are two undo timelines of undo history that get out of sync.

I've committed a fix for the common case that fails: - simple double free, and missing cow update: rB624294063910ad3c6459702a7e6aac592db3a720, rBd9d3e7778c9d0cb495620e1f5b483038f0193d09.

However issues remain:

  • Files loaded with Dyntopo enabled have a crash when undoing back to the beginning (then painting).
  • With undo/redo and mode switching I managed to cause an assert: BLI_assert(!"Cannot drop BMLogEntry from middle");.

So I'd like to keep this open since the way undo and sculpt mode bmesh log should be made to work more reliably.

Campbell Barton (campbellbarton) lowered the priority of this task from Confirmed, High to Normal.
Bastien (Pik) added a subscriber: Bastien (Pik).EditedNov 27 2018, 4:23 PM

I can confirm the bug. It happens systematically to me when following these steps:

  • turn on dyntopo
  • sculpt with any brush
  • press CTRL-Z
  • do one more stroke

Last tested revision: rB1d4ad6819857c2af3b3c6a2e287e120dc7125e6e

Stacktrace and error:

bin/blender(BLI_system_backtrace+0x26) [0x563fb74e6d80]
bin/blender(BM_log_entry_drop+0x147) [0x563fb6b92ef4]
bin/blender(+0x234ea14) [0x563fb6892a14]
bin/blender(+0x23511f9) [0x563fb68951f9]
bin/blender(+0x2cb52bd) [0x563fb71f92bd]
bin/blender(BKE_undosys_step_push_with_type+0xd5) [0x563fb71fa207]
bin/blender(BKE_undosys_step_push+0xbf) [0x563fb71fa558]
bin/blender(sculpt_undo_push_end+0x9c) [0x563fb689505c]
bin/blender(+0x234a28b) [0x563fb688e28b]
bin/blender(+0x231772c) [0x563fb685b72c]
bin/blender(paint_stroke_modal+0x465) [0x563fb685ca37]
bin/blender(+0x1d1a9df) [0x563fb625e9df]
bin/blender(+0x1d1c2e1) [0x563fb62602e1]
bin/blender(+0x1d1c3e3) [0x563fb62603e3]
bin/blender(wm_event_do_handlers+0x5f4) [0x563fb62616bc]
bin/blender(WM_main+0x30) [0x563fb625690d]
bin/blender(+0x1d0d640) [0x563fb6251640]
/lib/x86_64-linux-gnu/ [0x7f443f82cb17]
bin/blender(_start+0x2a) [0x563fb6250fda]
BLI_assert failed: /home/bastien/logiciels/blender/blender/source/blender/bmesh/intern/bmesh_log.c:744, BM_log_entry_drop(), at '!"Cannot drop BMLogEntry from middle"'

System information:

  • Debian GNU/Linux (current Sid)
  • Acer Aspire V Nitro
  • NVIDIA Corporation GM107M [GeForce GTX 960M] (rev ff)
  • happens whether I run blender through optirun or not
Bastien (Pik) added a comment.EditedJan 3 2019, 1:38 AM

Did a completely clean build today (rebuilt the dependencies and everything), the issue seems to be gone.
Revision rB11f2c65128dc9bdead56003df7c282b6e091cbd1

Hey, I wanna make a patch and submit for review but this problem is happening when I try to build blender for debugging.
I wanna make some changes to sculpt.c, should I just ignore or it can cause problems?