Removing a child should also unset its parent

This commit is contained in:
johni0702
2015-10-11 11:46:17 +02:00
parent d8a3df1f02
commit 07692d7879

View File

@@ -114,9 +114,12 @@ public abstract class AbstractGuiContainer<T extends AbstractGuiContainer<T>>
@Override @Override
public T removeElement(GuiElement element) { public T removeElement(GuiElement element) {
if (elements.remove(element) != null && layedOutElements != null) { if (elements.remove(element) != null) {
element.setContainer(null);
if (layedOutElements != null) {
layedOutElements.remove(element); layedOutElements.remove(element);
} }
}
return getThis(); return getThis();
} }