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; } } }
// Free up bitmaps used by the gadget, and call children to destroy themselves as well. // void UI_GADGET::destroy() { int i; UI_GADGET *cur; for ( i=0; i<m_num_frames; i++ ) { if (bmap_ids[i] != -1) { bm_release(bmap_ids[i]); bmap_ids[i] = -1; } } if (children) { cur = children; do { cur->destroy(); cur = cur->next; } while (cur != children); } }
// Free up bitmaps used by the gadget, and call children to destroy themselves as well. // void UI_GADGET::destroy() { int i; UI_GADGET *cur; for ( i=0; i<m_num_frames; i++ ) { if (bmap_ids[i] != -1) { // we need to unload here rather than release since some controls // may still need access to the bitmap slot. if it can be released // then the child should do it - taylor bm_unload(bmap_ids[i]); bmap_ids[i] = -1; } } if (children) { cur = children; do { cur->destroy(); cur = cur->next; } while (cur != children); } }