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,
LPVOID *obj)
{
HRESULT retVal = DD_OK;
LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
DX_WINDBG_trace();
_SEH_TRY
{
/* FIXME
the D3D object can be optained from here
Direct3D7
@ -33,17 +36,21 @@ Main_DirectDraw_QueryInterface (LPDIRECTDRAW7 iface,
This->lpVtbl = &DirectDraw7_Vtable;
This->lpLcl->dwLocalFlags = This->lpLcl->dwLocalFlags + DDRAWILCL_DIRECTDRAW7;
*obj = &This->lpVtbl;
Main_DirectDraw_AddRef(iface);
}
else
{
*obj = NULL;
DX_STUB_str("E_NOINTERFACE");
return E_NOINTERFACE;
retVal = E_NOINTERFACE;
}
}
_SEH_HANDLE
{
}
_SEH_END;
Main_DirectDraw_AddRef(iface);
DX_STUB_str("DD_OK");
return DD_OK;
return retVal;
}
ULONG WINAPI
@ -88,10 +95,12 @@ Main_DirectDraw_AddRef (LPDIRECTDRAW7 iface)
ULONG WINAPI
Main_DirectDraw_Release (LPDIRECTDRAW7 iface)
{
ULONG Counter = 0;
LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
DX_WINDBG_trace();
_SEH_TRY
{
if (iface!=NULL)
{
This->lpLcl->dwLocalRefCnt--;
@ -111,10 +120,21 @@ Main_DirectDraw_Release (LPDIRECTDRAW7 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

View file

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

View file

@ -493,6 +493,9 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
// if (mHALInfo.ddCaps.dwNumFourCCCodes > 0 )
// {
//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);
// mpFourCC = (DWORD *) DxHeapMemAlloc(sizeof(DWORD) * (mHALInfo.ddCaps.dwNumFourCCCodes + 2));