Crash when sculpting with a texture, deleting the image of the texture and exiting sculpt mode #106872
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#106872
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Windows 10
Graphics card: RTX 2070 Super
Blender Version
Broken: version: 3.4, 3.5, 3.6
Broken: version: 3.3.3, branch: master, commit date: 2023-01-17 08:40, hash:
rB8d94aeb604fa
Broken: 3.1.0
Worked: 3.0.1
Worked: 2.93 LTS
Caused by
9111ea78ac
Short description of error
Blender crashes when a texture image is deleted and you exit sculpt mode.
Exact steps for others to reproduce the error
You can test it inside the attached blend file. I basically just attached an image to a sculpting brush.
Crash occurs because
item->image->runtime.cache_mutex
is null insideBKE_image_pool_free
Seems like a long standing issue and repros back to at least 3.3 LTS (2.93 LTS is fine).
Caused by
9111ea78ac
Got a fix.
Since
9111ea78ac
,BKE_image_pool_free
would accessImagePoolItem
image->runtime.cache_mutex
[which could be NULL after deleting the Image ID from the Outliner]It would appear that the following diff fixes it in release builds, but still getting
heap-use-after-free
in a debug build:@Sergey would probably know better
The image itself is removed, so the
item->image
can not be de-referenced.One of the options is to limit the image pool to only be available during a stroke, and dispose it at the end of the stroke. It will solve those dangling pointers problem. The downside is that technically it causes extra lookup at the first pixel of the step of a stroke. I am not sure artists will notice a difference, but it needs to be tested. The testing can be done by clearing the
tex_pool
in thesculpt_stroke_done()
.Alternatively maybe it is possible to forbid deletion of ID when in painting mode.
Or somehow maintain a list of pools and remove entries from them when image datablock is removed. But such complex solution is something I'd try to avoid.
Shouldn't
SculptSession
data be handled as part ofobject_foreach_id
anyway? This struct stores other ID pointers too, like thescene
one...The
SculptSession
perhaps. It is a bit confusing how bad things are w.r.t removed IDs as many of them are re-assigned at the beginning of a stroke.That being said, I don't think
ImagePool
should be covered by any of foreach-id.