void icetDestroyContext(IceTContext context) { IceTContext saved_current_context; saved_current_context = icetGetContext(); if (context == saved_current_context) { icetRaiseDebug("Destroying current context."); saved_current_context = NULL; } /* Temporarily make the context to be destroyed current. */ icetSetContext(context); /* Call destructors for other dependent units. */ callDestructor(ICET_RENDER_LAYER_DESTRUCTOR); /* From here on out be careful. We are invalidating the context. */ context->magic_number = 0; icetStateDestroy(context->state); context->state = NULL; context->communicator->Destroy(context->communicator); /* The context is now completely destroyed and now null. Restore saved context. */ icetSetContext(saved_current_context); }
void icetDestroyContext(IceTContext context) { struct IceTContext *cp = &(context_list[context]); if (context == current_context_index) { icetRaiseDebug("Destroying current context."); } icetStateDestroy(cp->state); cp->state = NULL; free(cp->buffer); cp->communicator->Destroy(cp->communicator); cp->buffer = NULL; cp->buffer_size = 0; cp->buffer_offset = 0; if (cp->display_inflate_texture != 0) { glDeleteTextures(1, &(cp->display_inflate_texture)); } }