if (pChildContainer)
{
_ContainerImpl* pParent = pChildContainer->GetParent();
- if (pParent)
- {
- r = pParent->RemoveChild(pChildContainer, false);
- SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- }
+ SysTryReturn(NID_UI, pParent, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The control is not a child of this container.");
+
+ r = pParent->RemoveChild(pChildContainer, false);
+ SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
pChildContainer->RemoveAllChildren(true);
r = GetLastResult();
SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- Container* pContainer = &pChildContainer->GetPublic();
- delete pContainer;
- pContainer = null;
+ if (deallocate)
+ {
+ Container* pContainer = &pChildContainer->GetPublic();
+ delete pContainer;
+ pContainer = null;
+ }
}
else
{
+ SysTryReturn(NID_UI, pChild, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The control is not a child of this container.");
r = RemoveChild(pChild, deallocate);
SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
}