From dda58c93237467dade3526f630e1803ee6dc5fbf Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 15 Jun 2016 12:04:11 -0400 Subject: [PATCH] Fixed leaking issues with the previous commit. --- darwin/form.m | 6 ++---- windows/form.cpp | 9 +++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/darwin/form.m b/darwin/form.m index 614c6114..7cdb965a 100644 --- a/darwin/form.m +++ b/darwin/form.m @@ -408,15 +408,13 @@ struct uiForm { uiDarwinControlSetHuggingPriority(uiDarwinControl(fc.c), fc.oldHorzHuggingPri, NSLayoutConstraintOrientationHorizontal); uiDarwinControlSetHuggingPriority(uiDarwinControl(fc.c), fc.oldVertHuggingPri, NSLayoutConstraintOrientationVertical); - [fc.label removeFromSuperview]; - + [fc onDestroy]; [self->children removeObjectAtIndex:n]; [self establishOurConstraints]; - if (stretchy) { + if (stretchy) if ([self nStretchy] == 0) uiDarwinNotifyEdgeHuggingChanged(uiDarwinControl(self->f)); - } } - (int)isPadded diff --git a/windows/form.cpp b/windows/form.cpp index d0607235..febcc693 100644 --- a/windows/form.cpp +++ b/windows/form.cpp @@ -278,11 +278,12 @@ void uiFormAppend(uiForm *f, const char *label, uiControl *c, int stretchy) void uiFormDelete(uiForm *f, int index) { - uiControl *c; + struct formChild fc; - c = (*(f->controls))[index].c; - uiControlSetParent(c, NULL); - uiWindowsControlSetParentHWND(uiWindowsControl(c), NULL); + fc = (*(f->controls))[index]; + uiControlSetParent(fc.c, NULL); + uiWindowsControlSetParentHWND(uiWindowsControl(fc.c), NULL); + uiWindowsEnsureDestroyWindow(fc.label); f->controls->erase(f->controls->begin() + index); formArrangeChildren(f); uiWindowsControlMinimumSizeChanged(uiWindowsControl(f));