VirtualBox

Changeset 38366 in vbox


Ignore:
Timestamp:
Aug 9, 2011 6:55:53 AM (13 years ago)
Author:
vboxsync
Message:

wine/wddm: cleanup & fixes for window create/destroy

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxext.c

    r38363 r38366  
    241241}
    242242
     243/* wine serializes all calls to us, so no need for any synchronization here */
    243244static DWORD g_cVBoxExtInits = 0;
     245
     246static DWORD vboxExtAddRef()
     247{
     248    return ++g_cVBoxExtInits;
     249}
     250
     251static DWORD vboxExtRelease()
     252{
     253    DWORD cVBoxExtInits = --g_cVBoxExtInits;
     254    Assert(cVBoxExtInits < UINT32_MAX/2);
     255    return cVBoxExtInits;
     256}
     257
     258static DWORD vboxExtGetRef()
     259{
     260    return g_cVBoxExtInits;
     261}
     262
    244263HRESULT VBoxExtCheckInit()
    245264{
    246265    HRESULT hr = S_OK;
    247     if (!g_cVBoxExtInits)
     266    if (!vboxExtGetRef())
    248267    {
    249268        hr = vboxExtInit();
     
    254273        }
    255274    }
    256     ++g_cVBoxExtInits;
     275    vboxExtAddRef();
    257276    return S_OK;
    258277}
     
    261280{
    262281    HRESULT hr = S_OK;
    263     if (g_cVBoxExtInits == 1)
     282    if (vboxExtGetRef() == 1)
    264283    {
    265284        hr = vboxExtTerm();
     
    270289        }
    271290    }
    272     --g_cVBoxExtInits;
     291    vboxExtRelease();
    273292    return S_OK;
    274293}
     
    415434            *phWnd = hWnd;
    416435            *phDC = GetDC(hWnd);
     436            /* make sure we keep inited until the window is active */
     437            vboxExtAddRef();
    417438        }
    418439        else
     
    435456    Assert(bResult);
    436457    if (bResult)
     458    {
     459        /* release the reference we previously acquired on window creation */
     460        vboxExtRelease();
    437461        return S_OK;
     462    }
    438463
    439464    winErr = GetLastError();
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