nsSubscribableServer::~nsSubscribableServer(void) { nsresult rv = NS_OK; #ifdef DEBUG_seth printf("free subscribe tree\n"); #endif rv = FreeSubtree(mTreeRoot); NS_ASSERTION(NS_SUCCEEDED(rv),"failed to free tree"); }
NS_IMETHODIMP nsSubscribableServer::StartPopulating(nsIMsgWindow *aMsgWindow, bool aForceToServer, bool aGetOnlyNew /*ignored*/) { nsresult rv = NS_OK; mStopped = PR_FALSE; rv = FreeSubtree(mTreeRoot); mTreeRoot = nsnull; NS_ENSURE_SUCCESS(rv,rv); return NS_OK; }
nsresult nsSubscribableServer::FreeSubtree(SubscribeTreeNode *node) { nsresult rv = NS_OK; if (node) { // recursively free the children if (node->firstChild) { // will free node->firstChild rv = FreeSubtree(node->firstChild); NS_ENSURE_SUCCESS(rv,rv); node->firstChild = nsnull; } // recursively free the siblings if (node->nextSibling) { // will free node->nextSibling rv = FreeSubtree(node->nextSibling); NS_ENSURE_SUCCESS(rv,rv); node->nextSibling = nsnull; } #ifdef HAVE_SUBSCRIBE_DESCRIPTION NS_ASSERTION(node->description == nsnull, "you need to free the description"); #endif NS_Free(node->name); #if 0 node->name = nsnull; node->parent = nsnull; node->lastChild = nsnull; node->cachedChild = nsnull; #endif PR_Free(node); } return NS_OK; }
nsSubscribableServer::~nsSubscribableServer(void) { mozilla::DebugOnly<nsresult> rv = FreeSubtree(mTreeRoot); NS_ASSERTION(NS_SUCCEEDED(rv),"failed to free tree"); }