Skip to content

Fix crash drawing on empty tile layer in manual mode (fix #5620)#5732

Open
miguelfabiao125-bit wants to merge 1 commit into
aseprite:mainfrom
miguelfabiao125-bit:fix-manual-mode-crash
Open

Fix crash drawing on empty tile layer in manual mode (fix #5620)#5732
miguelfabiao125-bit wants to merge 1 commit into
aseprite:mainfrom
miguelfabiao125-bit:fix-manual-mode-crash

Conversation

@miguelfabiao125-bit

Copy link
Copy Markdown

Upon investigating the cell-addition logic for tilemap layers, I found that Manual Mode was creating new cels without properly attaching them. While PR #5720 resolved the immediate crash, the first interaction in Manual Mode was still incorrectly committing a tile.

To resolve this, I implemented an early exit within the commit function to bypass the data-writing process when in Manual Mode. However, this initially prevented the preview layer from being cleared.

To ensure a consistent UI state, I updated drawing_state to explicitly clean the preview buffer when the drawing loop is destroyed. This ensures that "ghost" pixels are removed even when a commit is opted out.

I declare that my contributions are not co-authored using a generative AI technology.

I agree that my contributions are licensed under the Individual Contributor License Agreement V4.0 ("CLA") as stated in https://github.com/igarastudio/cla/blob/main/cla.md

I have signed the CLA following the steps given in https://github.com/igarastudio/cla#signing

@aseprite-bot

Copy link
Copy Markdown
Collaborator

Hi there!

One or more of the commit messages in this PR do not match our code submission policy, please check the lint_commits CI job for more details on which commits were flagged and why.
Please do not close this PR and open another, instead modify your commit message(s) with git commit --amend and force push those changes to update this PR.

@miguelfabiao125-bit miguelfabiao125-bit force-pushed the fix-manual-mode-crash branch 2 times, most recently from 3e25063 to 90a409e Compare April 4, 2026 11:55
Upon investigating the cell-addition logic for tilemap layers, I found that Manual Mode was
creating new cels without properly attaching them. While PR aseprite#5720 resolved the immediate
crash, the first interaction in Manual Mode was still incorrectly committing a tile.

To resolve this, I implemented an early exit within the commit function to bypass the
data-writing process when in Manual Mode. However, this initially prevented the preview
layer from being cleared. To ensure a consistent UI state, I updated drawing_state to
explicitly clean the preview buffer when the drawing loop is destroyed.

This ensures that "ghost" pixels are removed even when a commit is opted out. I have also
added a test to make sure no other crash or tile creation is added by the manual tilemode
in the future.
@aseprite-bot

Copy link
Copy Markdown
Collaborator

clang-tidy review says "All clean, LGTM! 👍"

@dacap

dacap commented Apr 20, 2026

Copy link
Copy Markdown
Member

Thanks @miguelfabiao125-bit for this PR. Although this fixes the manual mode to avoid committing/adding new tiles, I'm not sure if we should show the preview at all. For example, if we already have a tilemap defined, the manual mode doesn't paint outside the tilemap area, so in the initial case we shouldn't show/preview nothing, probably showing a forbidden icon just like if the layer is locked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants