Added code to check that a control is not destroyed while it has a parent. This isn't enough for uiStack, though...
This commit is contained in:
parent
91522894c1
commit
24469a6e7b
|
@ -20,12 +20,10 @@ static void singleDestroy(uiControl *c)
|
||||||
{
|
{
|
||||||
singleView *s = (singleView *) (c->Internal);
|
singleView *s = (singleView *) (c->Internal);
|
||||||
|
|
||||||
|
if (s->parent != NULL)
|
||||||
|
complain("attempt to destroy a uiControl at %p while it still has a parent %p", c, s->parent);
|
||||||
[s->immediate retain]; // to keep alive when removing
|
[s->immediate retain]; // to keep alive when removing
|
||||||
(*(s->onDestroy))(s->onDestroyData);
|
(*(s->onDestroy))(s->onDestroyData);
|
||||||
if (s->parent != NULL) {
|
|
||||||
[s->immediate removeFromSuperview];
|
|
||||||
s->parent = NULL;
|
|
||||||
}
|
|
||||||
[destroyedControlsView addSubview:s->immediate];
|
[destroyedControlsView addSubview:s->immediate];
|
||||||
[s->immediate release];
|
[s->immediate release];
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@ static void singleDestroy(uiControl *c)
|
||||||
{
|
{
|
||||||
singleWidget *s = (singleWidget *) (c->Internal);
|
singleWidget *s = (singleWidget *) (c->Internal);
|
||||||
|
|
||||||
|
if (s->parent != NULL)
|
||||||
|
complain("attempt to destroy a uiControl at %p while it still has a parent %p", c, s->parent);
|
||||||
// first call the widget's own destruction code
|
// first call the widget's own destruction code
|
||||||
(*(s->onDestroy))(s->onDestroyData);
|
(*(s->onDestroy))(s->onDestroyData);
|
||||||
// then mark that we are ready to be destroyed
|
// then mark that we are ready to be destroyed
|
||||||
|
|
|
@ -20,6 +20,8 @@ static void singleDestroy(uiControl *c)
|
||||||
{
|
{
|
||||||
singleHWND *s = (singleHWND *) (c->Internal);
|
singleHWND *s = (singleHWND *) (c->Internal);
|
||||||
|
|
||||||
|
if (s->parent != NULL)
|
||||||
|
complain("attempt to destroy a uiControl at %p while it still has a parent %p", c, s->parent);
|
||||||
SendMessageW(s->hwnd, msgCanDestroyNow, 0, 0);
|
SendMessageW(s->hwnd, msgCanDestroyNow, 0, 0);
|
||||||
(*(s->onDestroy))(s->onDestroyData);
|
(*(s->onDestroy))(s->onDestroyData);
|
||||||
if (DestroyWindow(s->hwnd) == 0)
|
if (DestroyWindow(s->hwnd) == 0)
|
||||||
|
|
Loading…
Reference in New Issue