From c96fa447867bf9882b9c03e651b65157b716536c Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Mon, 1 Jun 2015 21:14:30 -0400 Subject: [PATCH] Fixed tabDelete() not properly preserving the child control. --- redo/windows/tab.c | 2 +- redo/windows/tabpage.c | 8 ++++++++ redo/windows/uipriv_windows.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/redo/windows/tab.c b/redo/windows/tab.c index 273f76ce..e1ae7550 100644 --- a/redo/windows/tab.c +++ b/redo/windows/tab.c @@ -180,7 +180,7 @@ static void tabDelete(uiTab *tt, uintmax_t n) ptrArrayDelete(t->pages, n); // and free the page - // this will keep the control alive + tabPagePreserveChild(page); uiControlSetParent(page, NULL); uiControlDestroy(page); } diff --git a/redo/windows/tabpage.c b/redo/windows/tabpage.c index 9b327ab1..d240cc50 100644 --- a/redo/windows/tabpage.c +++ b/redo/windows/tabpage.c @@ -142,6 +142,14 @@ void tabPageDestroyChild(uiControl *c) t->child = NULL; } +void tabPagePreserveChild(uiControl *c) +{ + struct tabPage *t = (struct tabPage *) c; + + uiControlSetParent(t->child, NULL); + t->child = NULL; +} + void tabPageSetChild(uiControl *c, uiControl *child) { struct tabPage *t = (struct tabPage *) c; diff --git a/redo/windows/uipriv_windows.h b/redo/windows/uipriv_windows.h index cb8caf2c..88db09a0 100644 --- a/redo/windows/uipriv_windows.h +++ b/redo/windows/uipriv_windows.h @@ -119,4 +119,5 @@ extern uiControl *newTabPage(void); extern int tabPageMargined(uiControl *); extern void tabPageSetMargined(uiControl *, int); extern void tabPageDestroyChild(uiControl *); +extern void tabPagePreserveChild(uiControl *); extern void tabPageSetChild(uiControl *, uiControl *);