Skip to content

ChestGui#setOnClose throws a StackOverFlowError / seems to run multiple times if it opens another GUI #2326

@JoelSoep

Description

@JoelSoep

Minecraft version: paper 1.21.6 (release)
IF version: 0.11.1

Hey there, I have an issue with closing GUIs. Everything worked perfectly when I was still running on 1.20.4, but after updating to 1.21.6 (and also updating the IF version for that sake) closing a gui and then opening another gui seems to loop many times, sometimes creating a stackoverflowerror (this behavior is inconsistent).

This can be reproduced with the following snippets:

public class TestGui extends ChestGui {
    private final Player player;
    public TestGui(Player player) {
        super(3, "test gui");
        this.player = player;
        closeLogic();
        this.show(player);
    }

    public void closeLogic() {
        this.setOnClose(event -> {
            new TestGui2(player);
        });
    }
}
public class TestGui2 extends ChestGui {
    public TestGui2(Player player) {
        super(3, "test gui 2");
        this.show(player);
    }
}

Opening the TestGui will result in the error, although it sometimes takes multiple tries to get it, including with server restarts. As mentioned before, this behavior is pretty inconsistent.

As for the stacktraces, I've tried to copy some, although they are too long, so I can't copy them in full.
https://pastebin.com/5PbrXpv4
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions