Author: greatlrd
Date: Sun Aug 6 13:56:21 2006
New Revision: 23493
URL:
http://svn.reactos.org/svn/reactos?rev=23493&view=rev
Log:
Bugfix DirectDraw_AddRef
Modified:
trunk/reactos/dll/directx/ddraw/main/ddraw_main.c
trunk/reactos/dll/directx/ddraw/rosdraw.h
trunk/reactos/dll/directx/ddraw/startup.c
Modified: trunk/reactos/dll/directx/ddraw/main/ddraw_main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/main/ddr…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/main/ddraw_main.c (original)
+++ trunk/reactos/dll/directx/ddraw/main/ddraw_main.c Sun Aug 6 13:56:21 2006
@@ -61,13 +61,18 @@
DX_WINDBG_trace();
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
- ULONG ref=0;
-
+
if (iface!=NULL)
{
- ref = InterlockedIncrement( (PLONG) &This->mDDrawLocal.dwLocalRefCnt);
+ This->mDDrawLocal.dwLocalRefCnt++;
+ This->Ref++;
+
+ if (This->mDDrawLocal.lpGbl != NULL)
+ {
+ This->mDDrawLocal.lpGbl->dwRefCnt++;
+ }
}
- return ref;
+ return This->Ref;
}
/*
@@ -81,13 +86,18 @@
DX_WINDBG_trace();
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
- ULONG ref=0;
-
+
if (iface!=NULL)
{
- ref = InterlockedDecrement( (PLONG) &This->mDDrawLocal.dwLocalRefCnt);
+ This->mDDrawLocal.dwLocalRefCnt--;
+ This->Ref--;
+
+ if (This->mDDrawLocal.lpGbl != NULL)
+ {
+ This->mDDrawLocal.lpGbl->dwRefCnt--;
+ }
- if (ref == 0)
+ if ( This->Ref == 0)
{
// set resoltion back to the one in registry
if(This->cooperative_level & DDSCL_EXCLUSIVE)
@@ -102,7 +112,7 @@
}
}
}
- return ref;
+ return This->Ref;
}
/*
Modified: trunk/reactos/dll/directx/ddraw/rosdraw.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/rosdraw.…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/rosdraw.h (original)
+++ trunk/reactos/dll/directx/ddraw/rosdraw.h Sun Aug 6 13:56:21 2006
@@ -49,6 +49,8 @@
IDirectDraw4Vtbl* lpVtbl_v4;
IDirectDraw2Vtbl* lpVtbl_v2;
IDirectDrawVtbl* lpVtbl_v1;
+
+ ULONG Ref;
/* The main struct that contain all info from the HAL and HEL */
HDC hdc;
Modified: trunk/reactos/dll/directx/ddraw/startup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/startup.…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/startup.c (original)
+++ trunk/reactos/dll/directx/ddraw/startup.c Sun Aug 6 13:56:21 2006
@@ -212,7 +212,8 @@
/* Setup calback struct so we do not need refill same info again */
This->mDdCreateSurface.lpDD = &This->mDDrawGlobal;
This->mDdCanCreateSurface.lpDD = &This->mDDrawGlobal;
-
+
+ This->mDDrawLocal.lpGbl = &This->mDDrawGlobal;
return DD_OK;
}