mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-30 04:13:33 +00:00
make the cleanup working as it should, do not crash when it try free unlinked dd interface.
svn path=/trunk/; revision=25158
This commit is contained in:
@@ -17,6 +17,8 @@ Cleanup(LPDIRECTDRAW7 iface)
|
||||
{
|
||||
LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
|
||||
|
||||
DX_WINDBG_trace();
|
||||
|
||||
if (ddgbl.lpDDCBtmp != NULL)
|
||||
{
|
||||
DxHeapMemFree(ddgbl.lpDDCBtmp);
|
||||
@@ -34,7 +36,7 @@ Cleanup(LPDIRECTDRAW7 iface)
|
||||
*/
|
||||
|
||||
/* release the linked interface */
|
||||
while (This->lpVtbl != NULL)
|
||||
while (!IsBadWritePtr( This->lpVtbl, sizeof( LPDDRAWI_DIRECTDRAW_INT )) )
|
||||
{
|
||||
LPDDRAWI_DIRECTDRAW_INT newThis = This->lpVtbl;
|
||||
if (This->lpLcl != NULL)
|
||||
@@ -42,7 +44,8 @@ Cleanup(LPDIRECTDRAW7 iface)
|
||||
DeleteDC(This->lpLcl->hDC);
|
||||
DxHeapMemFree(This->lpLcl);
|
||||
}
|
||||
|
||||
|
||||
DxHeapMemFree(This);
|
||||
This = newThis;
|
||||
}
|
||||
|
||||
@@ -52,6 +55,10 @@ Cleanup(LPDIRECTDRAW7 iface)
|
||||
DeleteDC(This->lpLcl->hDC);
|
||||
DxHeapMemFree(This->lpLcl);
|
||||
}
|
||||
if (This != NULL)
|
||||
{
|
||||
DxHeapMemFree(This);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ Main_DirectDraw_Release (LPDIRECTDRAW7 iface)
|
||||
This->lpLcl->lpGbl->dwRefCnt--;
|
||||
}
|
||||
|
||||
if ( This->dwIntRefCnt == 0)
|
||||
if ( This->lpLcl->lpGbl->dwRefCnt == 0)
|
||||
{
|
||||
// set resoltion back to the one in registry
|
||||
/*if(This->cooperative_level & DDSCL_EXCLUSIVE)
|
||||
@@ -94,13 +94,10 @@ Main_DirectDraw_Release (LPDIRECTDRAW7 iface)
|
||||
}*/
|
||||
|
||||
Cleanup(iface);
|
||||
if (This!=NULL)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return This ? This->dwIntRefCnt : 0;
|
||||
return This->dwIntRefCnt;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user