src/GLdispatch/GLdispatch.c
void __glDispatchFini(void)
{
    LockDispatch();

    if (clientRefcount <= 0) {
        assert(clientRefcount > 0);
        UnlockDispatch();
        return;
    }

    clientRefcount--;

    if (clientRefcount == 0) {
        __GLdispatchProcEntry *curProc, *tmpProc;

        /* This frees the dispatchStubList */
        UnregisterAllStubCallbacks();

        /* 
         * Before we get here, client libraries should
         * have cleared out the current dispatch list.
         */
        assert(glvnd_list_is_empty(&currentDispatchList));

        /*
         * Clear out the getProcAddress lists.
         */
        glvnd_list_for_each_entry_safe(curProc, tmpProc, &extProcList, entry) {
            glvnd_list_del(&curProc->entry);
            free(curProc->procName);
            free(curProc);
        }

        __glvndPthreadFuncs.key_delete(threadContextKey);

        // Clean up GLAPI thread state
        _glapi_destroy();
    }

    UnlockDispatch();
}
/*
 * Handles cleanup on library unload.
 */
Handles cleanup on library unload.
Handles cleanup on library unload .
void __glDispatchFini(void)
{
    LockDispatch();
    if (clientRefcount <= 0) {
        assert(clientRefcount > 0);
        UnlockDispatch();
        return;
    }
    clientRefcount--;
    if (clientRefcount == 0) {
        __GLdispatchProcEntry *curProc, *tmpProc;
        UnregisterAllStubCallbacks();
        assert(glvnd_list_is_empty(&currentDispatchList));
        glvnd_list_for_each_entry_safe(curProc, tmpProc, &extProcList, entry) {
            glvnd_list_del(&curProc->entry);
            free(curProc->procName);
            free(curProc);
        }
        __glvndPthreadFuncs.key_delete(threadContextKey);
        _glapi_destroy();
    }
    UnlockDispatch();
}
void __glDispatchFini ( void ) { LockDispatch ( ) ; if ( clientRefcount <= 0 ) { assert ( clientRefcount > 0 ) ; UnlockDispatch ( ) ; return ; } clientRefcount -- ; if ( clientRefcount == 0 ) { __GLdispatchProcEntry * curProc , * tmpProc ; UnregisterAllStubCallbacks ( ) ; assert ( glvnd_list_is_empty ( & currentDispatchList ) ) ; glvnd_list_for_each_entry_safe ( curProc , tmpProc , & extProcList , entry ) { glvnd_list_del ( & curProc -> entry ) ; free ( curProc -> procName ) ; free ( curProc ) ; } __glvndPthreadFuncs . key_delete ( threadContextKey ) ; _glapi_destroy ( ) ; } UnlockDispatch ( ) ; }
Handles cleanup on library unload.
Handles cleanup on library unload .
/* This frees the dispatchStubList */ /* 
         * Before we get here, client libraries should
         * have cleared out the current dispatch list.
         */ /*
         * Clear out the getProcAddress lists.
         */ // Clean up GLAPI thread state