Index: ddraw/glDirectDraw.cpp |
— | — | @@ -645,7 +645,6 @@ |
646 | 646 | TRACE_ENTER(1,14,this);
|
647 | 647 | if(initialized)
|
648 | 648 | {
|
649 | | - if(glD3D7) glD3D7->Release();
|
650 | 649 | RestoreDisplayMode();
|
651 | 650 | if(clippers)
|
652 | 651 | {
|
— | — | @@ -897,7 +896,14 @@ |
898 | 897 | if(!lpDDSurfaceDesc2) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
899 | 898 | if(pUnkOuter) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
900 | 899 | if(lpDDSurfaceDesc2->dwSize < sizeof(DDSURFACEDESC2)) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
901 | | - TRACE_RET(HRESULT,23,CreateSurface2(lpDDSurfaceDesc2,lplpDDSurface,pUnkOuter,TRUE));
|
| 900 | + HRESULT ret = CreateSurface2(lpDDSurfaceDesc2,lplpDDSurface,pUnkOuter,TRUE);
|
| 901 | + if (ret == DD_OK)
|
| 902 | + {
|
| 903 | + this->AddRef();
|
| 904 | + ((glDirectDrawSurface7*)lplpDDSurface)->creator = this;
|
| 905 | + }
|
| 906 | + TRACE_EXIT(23, ret);
|
| 907 | + return ret;
|
902 | 908 | }
|
903 | 909 |
|
904 | 910 |
|
— | — | @@ -2028,6 +2034,8 @@ |
2029 | 2035 | {
|
2030 | 2036 | lpDDS7->QueryInterface(IID_IDirectDrawSurface,(LPVOID*) lplpDDSurface);
|
2031 | 2037 | lpDDS7->Release();
|
| 2038 | + this->AddRef();
|
| 2039 | + ((glDirectDrawSurface7*)lpDDS7)->creator = this;
|
2032 | 2040 | TRACE_VAR("*lplpDDSurface",14,lplpDDSurface);
|
2033 | 2041 | TRACE_EXIT(23,DD_OK);
|
2034 | 2042 | return DD_OK;
|
— | — | @@ -2221,7 +2229,9 @@ |
2222 | 2230 | {
|
2223 | 2231 | lpDDS7->QueryInterface(IID_IDirectDrawSurface,(LPVOID*) lplpDDSurface);
|
2224 | 2232 | lpDDS7->Release();
|
2225 | | - TRACE_EXIT(23,DD_OK);
|
| 2233 | + this->AddRef();
|
| 2234 | + ((glDirectDrawSurface7*)lpDDS7)->creator = this;
|
| 2235 | + TRACE_EXIT(23, DD_OK);
|
2226 | 2236 | return DD_OK;
|
2227 | 2237 | }
|
2228 | 2238 | TRACE_EXIT(23,err);
|
— | — | @@ -2394,13 +2404,13 @@ |
2395 | 2405 | {
|
2396 | 2406 | TRACE_ENTER(1,14,this);
|
2397 | 2407 | if(!this) TRACE_RET(ULONG,8,0);
|
2398 | | - TRACE_RET(ULONG, 8, glDD7->AddRef());
|
| 2408 | + TRACE_RET(ULONG, 8, glDD7->AddRef4());
|
2399 | 2409 | }
|
2400 | 2410 | ULONG WINAPI glDirectDraw4::Release()
|
2401 | 2411 | {
|
2402 | 2412 | TRACE_ENTER(1,14,this);
|
2403 | 2413 | if(!this) TRACE_RET(ULONG,8,0);
|
2404 | | - TRACE_RET(ULONG, 8, glDD7->Release());
|
| 2414 | + TRACE_RET(ULONG, 8, glDD7->Release4());
|
2405 | 2415 | }
|
2406 | 2416 | HRESULT WINAPI glDirectDraw4::Compact()
|
2407 | 2417 | {
|
— | — | @@ -2433,7 +2443,9 @@ |
2434 | 2444 | {
|
2435 | 2445 | lpDDS7->QueryInterface(IID_IDirectDrawSurface4,(LPVOID*) lplpDDSurface);
|
2436 | 2446 | lpDDS7->Release();
|
2437 | | - TRACE_EXIT(23,DD_OK);
|
| 2447 | + this->AddRef();
|
| 2448 | + ((glDirectDrawSurface7*)lpDDS7)->creator = this;
|
| 2449 | + TRACE_EXIT(23, DD_OK);
|
2438 | 2450 | return DD_OK;
|
2439 | 2451 | }
|
2440 | 2452 | TRACE_EXIT(23,err);
|
Index: ddraw/glDirectDrawSurface.cpp |
— | — | @@ -40,6 +40,7 @@ |
41 | 41 | glDirectDrawPalette *palettein, TEXTURE *parenttex, DWORD miplevel)
|
42 | 42 | {
|
43 | 43 | TRACE_ENTER(5,14,this,14,lpDD7,14,lpDDSurfaceDesc2,14,error,14,palettein);
|
| 44 | + creator = NULL;
|
44 | 45 | overlay = false;
|
45 | 46 | hasstencil = false;
|
46 | 47 | dirty = 2;
|
— | — | @@ -397,6 +398,7 @@ |
398 | 399 | if(miptexture) miptexture->Release();
|
399 | 400 | if(device) device->Release();
|
400 | 401 | ddInterface->DeleteSurface(this);
|
| 402 | + if (creator) creator->Release();
|
401 | 403 | TRACE_EXIT(-1,0);
|
402 | 404 | }
|
403 | 405 | HRESULT WINAPI glDirectDrawSurface7::QueryInterface(REFIID riid, void** ppvObj)
|
Index: ddraw/glDirectDrawSurface.h |
— | — | @@ -140,6 +140,7 @@ |
141 | 141 | FBO fbo;
|
142 | 142 | FBO stencilfbo;
|
143 | 143 | glDirectDrawClipper *clipper;
|
| 144 | + IUnknown *creator;
|
144 | 145 | private:
|
145 | 146 | int swapinterval;
|
146 | 147 | ULONG refcount;
|