Page MenuHome

Gooseberry Branch - Apply button in modifiers crashes Blender
Closed, ResolvedPublic

Description

System Information
Operating system and graphics card

Kubuntu 14.10 64bits

Gooseberry Branch
Broken: (hash 2cacb22 - march 3 buildbot)
Worked: (Feb 27 buildbot)

The problem seems only so occur in the Gooseberry Branch.

If you press the "apply" button in any modifier of the Deform or Modify category, Blender crashes. Note that modifiers such as Armature and Mesh Deform, must have their target assigned in order to crash.

Just add a Cube and assign a smooth modifier, press apply and it crashes. Apply as shape seems to be working fine though.

Event Timeline

Juan Pablo Bouza (jpbouza) created this task.
Juan Pablo Bouza (jpbouza) raised the priority of this task from to Needs Triage by Developer.
Bastien Montagne (mont29) claimed this task.
Bastien Montagne (mont29) triaged this task as Normal priority.

This is caused by the take_ownership change in DM_to_mesh. Seems we need to forbid passing ownership and do it all in a copy if DM depends on mesh, but not sure how to check on that yet. Can look later after smashing the current bug i'm looking into.

@Bastien Montagne (mont29), here's a quick patch which prevents crash: http://www.pasteall.org/57028/diff which is likely safe.

But in theory we can do something lie this http://www.pasteall.org/57031/diff and avoid temp memory from allocation i think. Not sure there's no memory leaks here tho.

@Sergey Sharybin (sergey) ah, so you were on it too…

Yes, first patch will work, but as you says it's abit stupid since a single referenced layer will force copying the whole cdarray for that mesh element type.

Second one wont work, a given DM may use referenced data from any kind of CD type, in theory.

Root of the issue here is behavior of CD_ASSIGN in CDLayer copy context - it falls back to CD_REFERENCE when source does not own the data (CD_FLAG_NOFREE is set on source). What we want here is the reverse - to fallback to CD_DUPLICATE in this case. Proposed patch: D1158.