Fixed tabDelete() not properly preserving the child control.

This commit is contained in:
Pietro Gagliardi 2015-06-01 21:14:30 -04:00
parent 4db24bff05
commit c96fa44786
3 changed files with 10 additions and 1 deletions

View File

@ -180,7 +180,7 @@ static void tabDelete(uiTab *tt, uintmax_t n)
ptrArrayDelete(t->pages, n); ptrArrayDelete(t->pages, n);
// and free the page // and free the page
// this will keep the control alive tabPagePreserveChild(page);
uiControlSetParent(page, NULL); uiControlSetParent(page, NULL);
uiControlDestroy(page); uiControlDestroy(page);
} }

View File

@ -142,6 +142,14 @@ void tabPageDestroyChild(uiControl *c)
t->child = NULL; 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) void tabPageSetChild(uiControl *c, uiControl *child)
{ {
struct tabPage *t = (struct tabPage *) c; struct tabPage *t = (struct tabPage *) c;

View File

@ -119,4 +119,5 @@ extern uiControl *newTabPage(void);
extern int tabPageMargined(uiControl *); extern int tabPageMargined(uiControl *);
extern void tabPageSetMargined(uiControl *, int); extern void tabPageSetMargined(uiControl *, int);
extern void tabPageDestroyChild(uiControl *); extern void tabPageDestroyChild(uiControl *);
extern void tabPagePreserveChild(uiControl *);
extern void tabPageSetChild(uiControl *, uiControl *); extern void tabPageSetChild(uiControl *, uiControl *);