Created
September 10, 2019 08:11
-
-
Save deephack1982/2227441cfff80cf674b8f0636e7532f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CWidget | |
{ | |
... | |
public: | |
CEventListener* m_ppEventListeners; | |
int m_EventListenerCount; | |
private: | |
CWidget* m_pFirstChild; | |
CWidget* m_pSibling; | |
}; | |
void DestroyWidget(CWidget *pRoot) | |
{ | |
if(pRoot != 0) | |
{ | |
if(pRoot->m_ppEventListeners != 0) | |
{ | |
for(int j = 0; j < pRoot->m_EventListenerCount; ++j) | |
{ | |
pRoot->m_ppEventListeners[j]->UnRegister(pRoot); | |
} | |
delete pRoot->m_ppEventListeners; | |
} | |
CWidget *pChild = pRoot->GetFirstChild(); | |
while(pChild) | |
{ | |
DestroyWidget(pChild); | |
pChild = pChild->GetSibling(); | |
} | |
} | |
delete pRoot; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment