Skip to content

Allow gif encoding to be stopped (fix #2619)#5320

Merged
dacap merged 1 commit into
aseprite:mainfrom
ckaiser:gif-stop
Aug 4, 2025
Merged

Allow gif encoding to be stopped (fix #2619)#5320
dacap merged 1 commit into
aseprite:mainfrom
ckaiser:gif-stop

Conversation

@ckaiser

@ckaiser ckaiser commented Aug 1, 2025

Copy link
Copy Markdown
Member

Fixes #2619, here's a test file with a lot of frames to try it: f500.zip

@ckaiser ckaiser requested a review from dacap as a code owner August 1, 2025 23:48
@aseprite-bot

Copy link
Copy Markdown
Collaborator

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

for (gifframe_t gifFrame = 0; gifFrame < nframes; ++gifFrame) {
ASSERT(frame_it != frame_end);
if (m_fop->isStop())
break;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't return false?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way you end up with a valid GIF, even if it doesn't have the full frames. Better than a broken file IMO since we're already past the point where it's started writing to disk.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh it's fine in this way, other encoders do the same, and the issue is handled later checking if the operation was canceled so the sprite is marked as "modified", so the user has a second chance to save the file later.

@dacap dacap assigned ckaiser and dacap and unassigned dacap and ckaiser Aug 4, 2025
@dacap dacap merged commit 57309e5 into aseprite:main Aug 4, 2025
12 checks passed
@ckaiser ckaiser deleted the gif-stop branch September 10, 2025 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cancel button doesn't stop the animation export

3 participants