Skip to content

Lua error inside app.transaction causes undefined behavior and crashes. #3276

@smeeo

Description

@smeeo

If Lua throws an error inside app.transaction it is causing undefined behavior, eventually leading to segmentation fault.

It can be as simple as:

app.transaction(function()
    assert(crash)
end)

This causes a lot of random undefined behavior, mostly related to the undo history not working anymore or getting corrupted. Weird things can happen with selections too. If you continue in this state segmentation fault happens eventually.

It is possible to avoid it if you run your code inside a protected call like this:

app.transaction(function()
    local status, err = pcall(function()
        assert(crash)
    end)

    if status == false then
        print(err)
    end
end)

In this case the error is printed and nothing breaks.

I am on Linux, but I've briefly tried this on Windows as well and observed exact same behavior.

Aseprite and System version

  • Aseprite version: 1.3-beta-14-x64 (steam), 1.2.34.1-x64 (steam)
  • System: archlinux 5.17.3-arch1-1

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions