fixing smaller bugs in cleanup so it remove memory that we alloc, adding more seh around some ore api

svn path=/trunk/; revision=27035
This commit is contained in:
Magnus Olsen 2007-06-07 02:23:54 +00:00
parent 201a7b042d
commit 958b55cf2c
3 changed files with 67 additions and 40 deletions

View file

@ -19,10 +19,13 @@ Main_DirectDraw_QueryInterface (LPDIRECTDRAW7 iface,
REFIID id, REFIID id,
LPVOID *obj) LPVOID *obj)
{ {
HRESULT retVal = DD_OK;
LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
DX_WINDBG_trace(); DX_WINDBG_trace();
_SEH_TRY
{
/* FIXME /* FIXME
the D3D object can be optained from here the D3D object can be optained from here
Direct3D7 Direct3D7
@ -33,17 +36,21 @@ Main_DirectDraw_QueryInterface (LPDIRECTDRAW7 iface,
This->lpVtbl = &DirectDraw7_Vtable; This->lpVtbl = &DirectDraw7_Vtable;
This->lpLcl->dwLocalFlags = This->lpLcl->dwLocalFlags + DDRAWILCL_DIRECTDRAW7; This->lpLcl->dwLocalFlags = This->lpLcl->dwLocalFlags + DDRAWILCL_DIRECTDRAW7;
*obj = &This->lpVtbl; *obj = &This->lpVtbl;
Main_DirectDraw_AddRef(iface);
} }
else else
{ {
*obj = NULL; *obj = NULL;
DX_STUB_str("E_NOINTERFACE"); DX_STUB_str("E_NOINTERFACE");
return E_NOINTERFACE; retVal = E_NOINTERFACE;
} }
}
_SEH_HANDLE
{
}
_SEH_END;
Main_DirectDraw_AddRef(iface); return retVal;
DX_STUB_str("DD_OK");
return DD_OK;
} }
ULONG WINAPI ULONG WINAPI
@ -88,10 +95,12 @@ Main_DirectDraw_AddRef (LPDIRECTDRAW7 iface)
ULONG WINAPI ULONG WINAPI
Main_DirectDraw_Release (LPDIRECTDRAW7 iface) Main_DirectDraw_Release (LPDIRECTDRAW7 iface)
{ {
ULONG Counter = 0;
LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
DX_WINDBG_trace(); DX_WINDBG_trace();
_SEH_TRY
{
if (iface!=NULL) if (iface!=NULL)
{ {
This->lpLcl->dwLocalRefCnt--; This->lpLcl->dwLocalRefCnt--;
@ -111,10 +120,21 @@ Main_DirectDraw_Release (LPDIRECTDRAW7 iface)
}*/ }*/
Cleanup(iface); Cleanup(iface);
return 0; }
/* FIXME cleanup being not call why ?? */
Counter = This->dwIntRefCnt;
}
else
{
Counter = This->dwIntRefCnt;
} }
} }
return This->dwIntRefCnt; _SEH_HANDLE
{
}
_SEH_END;
return Counter;
} }
HRESULT WINAPI HRESULT WINAPI

View file

@ -15,7 +15,7 @@
VOID VOID
Cleanup(LPDIRECTDRAW7 iface) Cleanup(LPDIRECTDRAW7 iface)
{ {
//LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
DX_WINDBG_trace(); DX_WINDBG_trace();
@ -24,6 +24,11 @@ Cleanup(LPDIRECTDRAW7 iface)
DxHeapMemFree(ddgbl.lpDDCBtmp); DxHeapMemFree(ddgbl.lpDDCBtmp);
} }
if (ddgbl.lpdwFourCC != NULL)
{
DxHeapMemFree(ddgbl.lpdwFourCC);
}
if (ddgbl.lpModeInfo != NULL) if (ddgbl.lpModeInfo != NULL)
{ {
DxHeapMemFree(ddgbl.lpModeInfo); DxHeapMemFree(ddgbl.lpModeInfo);
@ -50,11 +55,10 @@ Cleanup(LPDIRECTDRAW7 iface)
//} //}
/* release unlinked interface */ /* release unlinked interface */
//if (This->lpLcl != NULL) if (This->lpLcl != NULL)
//{ {
// DeleteDC(This->lpLcl->hDC); DxHeapMemFree(This->lpLcl);
// DxHeapMemFree(This->lpLcl); }
//}
//if (This != NULL) //if (This != NULL)
//{ //{
// DxHeapMemFree(This); // DxHeapMemFree(This);

View file

@ -493,6 +493,9 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
// if (mHALInfo.ddCaps.dwNumFourCCCodes > 0 ) // if (mHALInfo.ddCaps.dwNumFourCCCodes > 0 )
// { // {
//mpFourCC = (DWORD *) DxHeapMemAlloc( sizeof(DWORD) * 21); //mpFourCC = (DWORD *) DxHeapMemAlloc( sizeof(DWORD) * 21);
/* DrFred uncomet line 499 see if u getting werid crash in
* u computer, run the ddraw_test around 3-4 times
*/
//DxHeapMemAlloc(mpFourCC, sizeof(DWORD) * 21); //DxHeapMemAlloc(mpFourCC, sizeof(DWORD) * 21);
// mpFourCC = (DWORD *) DxHeapMemAlloc(sizeof(DWORD) * (mHALInfo.ddCaps.dwNumFourCCCodes + 2)); // mpFourCC = (DWORD *) DxHeapMemAlloc(sizeof(DWORD) * (mHALInfo.ddCaps.dwNumFourCCCodes + 2));