void UI_WINDOW::destroy() { UI_GADGET *cur; int idx; // free up any bitmaps release_bitmaps(); // destroy all gadgets if (first_gadget) { cur = first_gadget; do { cur->destroy(); cur = cur->next; } while (cur != first_gadget); } // free up all xstrs for(idx=0; idx<MAX_UI_XSTRS; idx++){ // free up this struct if(xstrs[idx] != NULL){ if(xstrs[idx]->xstr != NULL){ // This const_cast is safe since the string was allocated by vm_strdup vm_free(const_cast<char*>(xstrs[idx]->xstr)); } vm_free(xstrs[idx]); xstrs[idx] = NULL; } } }
void UI_WINDOW::destroy() { UI_GADGET* cur; int idx; // free up any bitmaps release_bitmaps(); // destroy all gadgets if (first_gadget) { cur = first_gadget; do { cur->destroy(); cur = cur->next; } while (cur != first_gadget); } // free up all xstrs for (idx = 0; idx < MAX_UI_XSTRS; idx++) { // free up this struct if (xstrs[idx] != NULL) { if (xstrs[idx]->xstr != NULL) { vm_free(xstrs[idx]->xstr); } vm_free(xstrs[idx]); xstrs[idx] = NULL; } } }