VirtualBox

Ignore:
Timestamp:
Oct 17, 2009 2:51:40 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
53598
Message:

crOpenGL: make sure window being destroyed isn't bound to opengl contexts

Location:
trunk/src/VBox/HostServices/SharedOpenGL
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c

    r21576 r23840  
    119119}
    120120
    121 void crServerCheckCurrentCtxWindowCB(unsigned long key, void *data1, void *data2)
    122 {
    123     CRContext *crCtx = (CRContext *) data1;
    124     GLint window = *(GLint*)data2;
    125 
    126     (void) key;
    127 }
    128 
    129121void SERVER_DISPATCH_APIENTRY
    130122crServerDispatchWindowDestroy( GLint window )
     
    194186    }
    195187
    196     crHashtableWalk(cr_server.contextTable, crServerCheckCurrentCtxWindowCB, &window);
    197188    crHashtableDelete(cr_server.pWindowCreateInfoTable, window, crServerCreateInfoDeleteCB);
    198189    crHashtableDelete(cr_server.muralTable, window, crFree);
    199190}
    200 
    201191
    202192void SERVER_DISPATCH_APIENTRY
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.c

    r22509 r23840  
    338338}
    339339
     340static void renderspuCheckCurrentCtxWindowCB(unsigned long key, void *data1, void *data2)
     341{
     342    ContextInfo *pCtx = (ContextInfo *) data1;
     343    WindowInfo *pWindow = data2;
     344    (void) key;
     345
     346    if (pCtx->currentWindow==pWindow)
     347    {
     348        renderspuMakeCurrent(0, 0, pCtx->id);
     349    }   
     350}
    340351
    341352static void
     
    343354{
    344355    WindowInfo *window;
     356    GET_CONTEXT(pOldCtx);
     357
    345358    CRASSERT(win >= 0);
    346359    window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, win);
     
    350363        /* remove window info from hash table, and free it */
    351364        crHashtableDelete(render_spu.windowTable, win, crFree);
     365
     366        /* check if this window is bound to some ctx. Note: window pointer is already freed here */
     367        crHashtableWalk(render_spu.contextTable, renderspuCheckCurrentCtxWindowCB, window);
     368
     369        /* restore current context */
     370        {
     371            GET_CONTEXT(pNewCtx);
     372            if (pNewCtx!=pOldCtx)
     373            {
     374                renderspuMakeCurrent(pOldCtx&&pOldCtx->currentWindow ? pOldCtx->currentWindow->id:0, 0,
     375                                     pOldCtx ? pOldCtx->id:0);
     376            }
     377        }
    352378    }
    353379    else {
Note: See TracChangeset for help on using the changeset viewer.

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