/********************************************************************* * Function: void GOLFree() * * PreCondition: none * * Input: none * * Output: none * * Side Effects: none * * Overview: frees memory of all objects in the current linked list * and starts a new linked list. This function must be * called only inside the GOLDrawCallback()function when * using GOLDraw() and GOLMsg() to manage rendering and * message processing. * * Note: drawing and messaging must be suspended * ********************************************************************/ void GOLFree(void) { OBJ_HEADER *pNextObj; OBJ_HEADER *pCurrentObj; pCurrentObj = _pGolObjects; while(pCurrentObj != NULL) { pNextObj = (OBJ_HEADER *)pCurrentObj->pNxtObj; // check if there are additional items to free if(pCurrentObj->FreeObj) pCurrentObj->FreeObj(pCurrentObj); GFX_free(pCurrentObj); pCurrentObj = pNextObj; } GOLNewList(); #ifdef USE_DOUBLE_BUFFERING InvalidateAll(); #endif }
/********************************************************************* * Function: void GOLFree() * * PreCondition: none * * Input: none * * Output: none * * Side Effects: none * * Overview: frees memory of all objects in the current linked list * and starts a new linked list * * Note: drawing and messaging must be suspended * ********************************************************************/ void GOLFree(){ OBJ_HEADER * pNextObj; OBJ_HEADER * pCurrentObj; pCurrentObj = _pGolObjects; while(pCurrentObj != NULL){ pNextObj = pCurrentObj->pNxtObj; #ifdef USE_LISTBOX if(pCurrentObj->type == OBJ_LISTBOX) LbDelItemsList((LISTBOX*)pCurrentObj); #endif #ifdef USE_GRID if(pCurrentObj->type == OBJ_GRID) GridFreeItems((GRID*)pCurrentObj); #endif free(pCurrentObj); pCurrentObj = pNextObj; } GOLNewList(); }