Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
167ffc7b
Commit
167ffc7b
authored
Jun 19, 2011
by
Ričardas Barkauskas
Committed by
Alexandre Julliard
Jun 21, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Separate IDirectDrawSurface2 reference count.
parent
a9f72a30
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
16 deletions
+35
-16
ddraw_private.h
dlls/ddraw/ddraw_private.h
+1
-1
main.c
dlls/ddraw/main.c
+6
-3
surface.c
dlls/ddraw/surface.c
+22
-6
dsurface.c
dlls/ddraw/tests/dsurface.c
+6
-6
No files found.
dlls/ddraw/ddraw_private.h
View file @
167ffc7b
...
...
@@ -161,7 +161,7 @@ struct IDirectDrawSurfaceImpl
const
IDirect3DTexture2Vtbl
*
IDirect3DTexture2_vtbl
;
const
IDirect3DTextureVtbl
*
IDirect3DTexture_vtbl
;
LONG
ref
,
iface_count
;
LONG
ref
,
ref2
,
iface_count
;
IUnknown
*
ifaceToRelease
;
int
version
;
...
...
dlls/ddraw/main.c
View file @
167ffc7b
...
...
@@ -752,10 +752,12 @@ DestroyCallback(IDirectDrawSurface7 *surf,
void
*
context
)
{
IDirectDrawSurfaceImpl
*
Impl
=
impl_from_IDirectDrawSurface7
(
surf
);
ULONG
ref
;
ULONG
ref
,
ref2
;
ref
=
IDirectDrawSurface7_Release
(
surf
);
/* For the EnumSurfaces */
WARN
(
"Surface %p has an reference count of %d
\n
"
,
Impl
,
ref
);
IDirectDrawSurface2_AddRef
(
&
Impl
->
IDirectDrawSurface2_iface
);
ref2
=
IDirectDrawSurface2_Release
(
&
Impl
->
IDirectDrawSurface2_iface
);
WARN
(
"Surface %p has an reference counts of %d 2: %d
\n
"
,
Impl
,
ref
,
ref2
);
/* Skip surfaces which are attached somewhere or which are
* part of a complex compound. They will get released when destroying
...
...
@@ -765,7 +767,8 @@ DestroyCallback(IDirectDrawSurface7 *surf,
return
DDENUMRET_OK
;
/* Destroy the surface */
while
(
ref
)
ref
=
IDirectDrawSurface7_Release
(
surf
);
while
(
ref
)
ref
=
IDirectDrawSurface7_Release
(
surf
);
while
(
ref2
)
ref2
=
IDirectDrawSurface2_Release
(
&
Impl
->
IDirectDrawSurface2_iface
);
return
DDENUMRET_OK
;
}
...
...
dlls/ddraw/surface.c
View file @
167ffc7b
...
...
@@ -97,7 +97,7 @@ static HRESULT WINAPI ddraw_surface7_QueryInterface(IDirectDrawSurface7 *iface,
}
else
if
(
IsEqualGUID
(
riid
,
&
IID_IDirectDrawSurface2
))
{
I
Unknown_AddRef
(
iface
);
I
DirectDrawSurface2_AddRef
(
&
This
->
IDirectDrawSurface2_
iface
);
*
obj
=
&
This
->
IDirectDrawSurface2_iface
;
TRACE
(
"(%p) returning IDirectDrawSurface2 interface at %p
\n
"
,
This
,
*
obj
);
return
S_OK
;
...
...
@@ -274,9 +274,16 @@ static ULONG WINAPI ddraw_surface3_AddRef(IDirectDrawSurface3 *iface)
static
ULONG
WINAPI
ddraw_surface2_AddRef
(
IDirectDrawSurface2
*
iface
)
{
IDirectDrawSurfaceImpl
*
This
=
impl_from_IDirectDrawSurface2
(
iface
);
TRACE
(
"iface %p.
\n
"
,
iface
);
ULONG
refcount
=
InterlockedIncrement
(
&
This
->
ref2
);
return
ddraw_surface7_AddRef
(
&
This
->
IDirectDrawSurface7_iface
);
TRACE
(
"iface %p increasing refcount to %u.
\n
"
,
iface
,
refcount
);
if
(
refcount
==
1
)
{
ddraw_surface_add_iface
(
This
);
}
return
refcount
;
}
static
ULONG
WINAPI
ddraw_surface1_AddRef
(
IDirectDrawSurface
*
iface
)
...
...
@@ -335,7 +342,7 @@ void ddraw_surface_destroy(IDirectDrawSurfaceImpl *This)
* because the 2nd surface was addref()ed when the app
* called GetAttachedSurface
*/
WARN
(
"(%p): Destroying surface with ref
ount %d
\n
"
,
This
,
This
->
ref
);
WARN
(
"(%p): Destroying surface with ref
counts %d 2: %d
\n
"
,
This
,
This
->
ref
,
This
->
ref2
);
}
if
(
This
->
wined3d_surface
)
...
...
@@ -522,9 +529,16 @@ static ULONG WINAPI ddraw_surface3_Release(IDirectDrawSurface3 *iface)
static
ULONG
WINAPI
ddraw_surface2_Release
(
IDirectDrawSurface2
*
iface
)
{
IDirectDrawSurfaceImpl
*
This
=
impl_from_IDirectDrawSurface2
(
iface
);
TRACE
(
"iface %p.
\n
"
,
iface
);
ULONG
refcount
=
InterlockedDecrement
(
&
This
->
ref2
);
return
ddraw_surface7_Release
(
&
This
->
IDirectDrawSurface7_iface
);
TRACE
(
"iface %p decreasing refcount to %u.
\n
"
,
iface
,
refcount
);
if
(
refcount
==
0
)
{
ddraw_surface_release_iface
(
This
);
}
return
refcount
;
}
static
ULONG
WINAPI
ddraw_surface1_Release
(
IDirectDrawSurface
*
iface
)
...
...
@@ -755,6 +769,8 @@ static HRESULT WINAPI ddraw_surface2_GetAttachedSurface(IDirectDrawSurface2 *ifa
}
attachment_impl
=
impl_from_IDirectDrawSurface7
(
attachment7
);
*
attachment
=
&
attachment_impl
->
IDirectDrawSurface2_iface
;
ddraw_surface2_AddRef
(
*
attachment
);
ddraw_surface7_Release
(
attachment7
);
return
hr
;
}
...
...
dlls/ddraw/tests/dsurface.c
View file @
167ffc7b
...
...
@@ -1080,15 +1080,15 @@ static void IFaceRefCount(void)
IDirectDrawSurface_QueryInterface
(
surf
,
&
IID_IDirectDrawSurface2
,
(
void
**
)
&
surf2
);
ref
=
getRefcount
((
IUnknown
*
)
surf
);
todo_wine
ok
(
ref
==
1
,
"Refcount is %u, expected 1
\n
"
,
ref
);
/* Check the ref count is one */
ok
(
ref
==
1
,
"Refcount is %u, expected 1
\n
"
,
ref
);
/* Check the ref count is one */
ref
=
getRefcount
((
IUnknown
*
)
surf2
);
todo_wine
ok
(
ref
==
1
,
"Refcount is %u, expected 1
\n
"
,
ref
);
/* This should also be one */
ok
(
ref
==
1
,
"Refcount is %u, expected 1
\n
"
,
ref
);
/* This should also be one */
IDirectDrawSurface_QueryInterface
(
surf
,
&
IID_IDirectDrawSurface2
,
(
void
**
)
&
surf2a
);
ref
=
getRefcount
((
IUnknown
*
)
surf2
);
todo_wine
ok
(
ref
==
2
,
"Refcount is %u, expected 2
\n
"
,
ref
);
/* Surf2's refcount should be 2 now, but surf should be 1 */
ok
(
ref
==
2
,
"Refcount is %u, expected 2
\n
"
,
ref
);
/* Surf2's refcount should be 2 now, but surf should be 1 */
ref
=
getRefcount
((
IUnknown
*
)
surf
);
todo_wine
ok
(
ref
==
1
,
"Refcount is %u, expected 1
\n
"
,
ref
);
ok
(
ref
==
1
,
"Refcount is %u, expected 1
\n
"
,
ref
);
IDirectDrawSurface_QueryInterface
(
surf
,
&
IID_IDirectDrawSurface3
,
(
void
**
)
&
surf3
);
ref
=
getRefcount
((
IUnknown
*
)
surf3
);
...
...
@@ -1142,10 +1142,10 @@ static void IFaceRefCount(void)
}
ref
=
IDirectDrawSurface2_Release
(
surf2
);
/* Release one of the 2 surf2 interfaces */
todo_wine
ok
(
ref
==
1
,
"Refcount is %u, expected 1
\n
"
,
ref
);
ok
(
ref
==
1
,
"Refcount is %u, expected 1
\n
"
,
ref
);
ref
=
IDirectDrawSurface2_Release
(
surf2a
);
/* Release the other */
todo_wine
ok
(
ref
==
0
,
"Refcount is %u, expected 0
\n
"
,
ref
);
ok
(
ref
==
0
,
"Refcount is %u, expected 0
\n
"
,
ref
);
ref
=
IDirectDrawSurface3_Release
(
surf3
);
todo_wine
ok
(
ref
==
0
,
"Refcount is %u, expected 0
\n
"
,
ref
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment