SomeSourceCode / SomeGuiApi

A Paper API to create interactable GUIs using Minecraft Inventories, ...
MIT License
1 stars 0 forks source link

Cycle detection #21

Closed SomeSourceCode closed 2 months ago

SomeSourceCode commented 3 months ago

Description

Implement cycle detection, for cases where adding a Node to a Parent creates an infite loop with the Node containing the Parent somewhere in its hierarchy.

For example:

Pane pane1 = new Pane();
Pane pane2 = new Pane();
Pane pane3 = new Pane();

pane1.getChildren().add(pane2);
pane2.getChildren().add(pane3)

So far, this should work fine.

pane3.getChildren().add(pane1);

This should be detected and handled as now the Panes contain each other which is not possible:

pane1  <┐
  |     |
  v     |
pane2   |
  |     |
  v     |
pane3   |
  └─────┘