VirtualBox

Changeset 55623 in vbox


Ignore:
Timestamp:
May 3, 2015 3:33:55 PM (9 years ago)
Author:
vboxsync
Message:

3D: Pack SPU: more carefull with pointers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c

    r52262 r55623  
    454454    CRASSERT(slot < pack_spu.numContexts);
    455455
    456     context = &(pack_spu.context[slot]);
    457 
    458     if (CRPACKSPU_IS_WDDM_CRHGSMI())
    459     {
    460         thread = context->currentThread;
    461         crPackSetContext(thread->packer);
    462         CRASSERT(!(thread->packer == curPacker) == !(thread == curThread));
    463     }
    464     CRASSERT(thread);
     456    context = (slot >= 0 && slot < pack_spu.numContexts) ? &(pack_spu.context[slot]) : NULL;
    465457    curContext = curThread ? curThread->currentContext : NULL;
    466458
    467     if (pack_spu.swap)
    468         crPackDestroyContextSWAP( context->serverCtx );
    469     else
    470         crPackDestroyContext( context->serverCtx );
    471 
    472     crStateDestroyContext( context->clientState );
    473 
    474     context->clientState = NULL;
    475     context->serverCtx = 0;
    476     context->currentThread = NULL;
    477 
    478     crMemset (&context->zvaBufferInfo, 0, sizeof (context->zvaBufferInfo));
     459    if (context)
     460    {
     461        if (CRPACKSPU_IS_WDDM_CRHGSMI())
     462        {
     463            thread = context->currentThread;
     464            if (thread)
     465            {
     466                crPackSetContext(thread->packer);
     467                CRASSERT(!(thread->packer == curPacker) == !(thread == curThread));
     468            }
     469        }
     470
     471        if (pack_spu.swap)
     472            crPackDestroyContextSWAP( context->serverCtx );
     473        else
     474            crPackDestroyContext( context->serverCtx );
     475
     476        crStateDestroyContext( context->clientState );
     477
     478        context->clientState = NULL;
     479        context->serverCtx = 0;
     480        context->currentThread = NULL;
     481
     482        crMemset (&context->zvaBufferInfo, 0, sizeof (context->zvaBufferInfo));
     483    }
    479484
    480485    if (curContext == context)
     
    503508void PACKSPU_APIENTRY packspu_MakeCurrent( GLint window, GLint nativeWindow, GLint ctx )
    504509{
    505     ThreadInfo *thread;
     510    ThreadInfo *thread = NULL;
    506511    GLint serverCtx;
    507     ContextInfo *newCtx;
     512    ContextInfo *newCtx = NULL;
    508513
    509514    if (!CRPACKSPU_IS_WDDM_CRHGSMI())
     
    528533
    529534        newCtx = &pack_spu.context[slot];
     535        CRASSERT(newCtx);
    530536        CRASSERT(newCtx->clientState);  /* verify valid */
    531537
     
    539545        else
    540546        {
     547            CRASSERT(thread);
    541548            if (newCtx->fAutoFlush)
    542549            {
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette