From a1ba612314fc479a46451f1af34a64b4281b1c7d Mon Sep 17 00:00:00 2001 From: Yaram Date: Sun, 16 Jun 2019 20:06:22 +1000 Subject: [PATCH] Fix clearing of control parent --- src/UiControl.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/UiControl.cc b/src/UiControl.cc index 85db9e6..ba4b708 100644 --- a/src/UiControl.cc +++ b/src/UiControl.cc @@ -41,7 +41,11 @@ void UiControl::destroy() { } void UiControl::setParent(UiControl *parent) { - uiControlSetParent(handle, parent->getHandle()); + if (parent == NULL) { + uiControlSetParent(handle, NULL); + } else { + uiControlSetParent(handle, parent->getHandle()); + } } bool UiControl::toplevel() { @@ -74,7 +78,7 @@ void UiControl::setEnabled(bool enabled) { NBIND_CLASS(UiControl) { method(destroy); - method(setParent); + method(setParent, "setParent", nbind::Nullable()); method(toplevel); method(getVisible); method(setVisible);