foxnne / pixi

Pixel art editor made with Zig.
https://foxnne.github.io/pixi/
MIT License
773 stars 25 forks source link

panic / index out of bounds during copy/paste(maybe?) after deleting layer #58

Open slimsag opened 5 months ago

slimsag commented 5 months ago

Not sure how exactly I triggered this, but I think it was during copy/paste after deleting a layer.

thread 2282599 panic: index out of bounds: index 1, len 1
/Volumes/data/slimsag/pixi/src/storage/internal.zig:1334:45: 0x102d0bd73 in spriteToImage (pixi)
            const layer = &file.layers.items[file.selected_layer_index];
                                            ^
/Volumes/data/slimsag/pixi/src/storage/internal.zig:933:64: 0x102d0c36b in copy (pixi)
            pixi.state.clipboard_image = try self.spriteToImage(self.selected_sprite_index, false);
                                                               ^
/Volumes/data/slimsag/pixi/src/input/Hotkeys.zig:251:30: 0x102d12f17 in process (pixi)
                try file.copy();
                             ^
/Volumes/data/slimsag/pixi/src/input/input.zig:8:39: 0x102d13e77 in process (pixi)
        try pixi.state.hotkeys.process();
                                      ^
/Volumes/data/slimsag/pixi/src/pixi.zig:319:22: 0x102d17a1b in update (pixi)
    try input.process();
                     ^
/Users/slimsag/.cache/zig/p/122015e1dac4afaf275f7f2adde3814e6a27f5799cbef96bb487ee305f7e33f4dca3/src/core/platform/glfw/Core.zig:587:23: 0x102cc888f in appUpdateThreadTick__anon_78859 (pixi)
        if (app.update() catch unreachable) {
                      ^
/Users/slimsag/.cache/zig/p/122015e1dac4afaf275f7f2adde3814e6a27f5799cbef96bb487ee305f7e33f4dca3/src/core/platform/glfw/Core.zig:606:36: 0x102caff0f in appUpdateThread__anon_78602 (pixi)
    while (self.appUpdateThreadTick(app)) {}
                                   ^
/Users/slimsag/zig/0.13.0-dev.351+64ef45eb0/files/lib/std/Thread.zig:408:13: 0x102c83507 in callFn__anon_78017 (pixi)
            @call(.auto, f, args);
            ^
/Users/slimsag/zig/0.13.0-dev.351+64ef45eb0/files/lib/std/Thread.zig:674:30: 0x102c4ce43 in entryFn (pixi)
                return callFn(f, args_ptr.*);
                             ^
???:?:?: 0x18c76d033 in ??? (libsystem_pthread.dylib)
???:?:?: 0x885f80018c767e3b in ??? (???)
run
└─ run pixi failure
error: the following command terminated unexpectedly:
foxnne commented 5 months ago

Thanks! I'll try to recreate this.