Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
4b8fd522
Commit
4b8fd522
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: Add iface count for IDirectSurfaceImpl.
parent
8959a139
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
30 deletions
+55
-30
ddraw_private.h
dlls/ddraw/ddraw_private.h
+1
-1
surface.c
dlls/ddraw/surface.c
+54
-29
No files found.
dlls/ddraw/ddraw_private.h
View file @
4b8fd522
...
...
@@ -161,7 +161,7 @@ struct IDirectDrawSurfaceImpl
const
IDirect3DTexture2Vtbl
*
IDirect3DTexture2_vtbl
;
const
IDirect3DTextureVtbl
*
IDirect3DTexture_vtbl
;
LONG
ref
;
LONG
ref
,
iface_count
;
IUnknown
*
ifaceToRelease
;
int
version
;
...
...
dlls/ddraw/surface.c
View file @
4b8fd522
...
...
@@ -215,6 +215,22 @@ static HRESULT WINAPI d3d_texture1_QueryInterface(IDirect3DTexture *iface, REFII
return
ddraw_surface7_QueryInterface
(
&
This
->
IDirectDrawSurface7_iface
,
riid
,
object
);
}
static
void
ddraw_surface_add_iface
(
IDirectDrawSurfaceImpl
*
This
)
{
ULONG
iface_count
=
InterlockedIncrement
(
&
This
->
iface_count
);
TRACE
(
"%p increasing iface count to %u.
\n
"
,
This
,
iface_count
);
if
(
iface_count
==
1
)
{
EnterCriticalSection
(
&
ddraw_cs
);
if
(
This
->
wined3d_surface
)
wined3d_surface_incref
(
This
->
wined3d_surface
);
if
(
This
->
wined3d_texture
)
wined3d_texture_incref
(
This
->
wined3d_texture
);
LeaveCriticalSection
(
&
ddraw_cs
);
}
}
/*****************************************************************************
* IDirectDrawSurface7::AddRef
*
...
...
@@ -227,21 +243,16 @@ static HRESULT WINAPI d3d_texture1_QueryInterface(IDirect3DTexture *iface, REFII
static
ULONG
WINAPI
ddraw_surface7_AddRef
(
IDirectDrawSurface7
*
iface
)
{
IDirectDrawSurfaceImpl
*
This
=
impl_from_IDirectDrawSurface7
(
iface
);
ULONG
ref
C
ount
=
InterlockedIncrement
(
&
This
->
ref
);
ULONG
ref
c
ount
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"
%p increasing refcount to %u.
\n
"
,
This
,
refC
ount
);
TRACE
(
"
iface %p increasing refcount to %u.
\n
"
,
iface
,
refc
ount
);
if
(
ref
C
ount
==
1
)
if
(
ref
c
ount
==
1
)
{
EnterCriticalSection
(
&
ddraw_cs
);
if
(
This
->
wined3d_surface
)
wined3d_surface_incref
(
This
->
wined3d_surface
);
if
(
This
->
wined3d_texture
)
wined3d_texture_incref
(
This
->
wined3d_texture
);
LeaveCriticalSection
(
&
ddraw_cs
);
ddraw_surface_add_iface
(
This
);
}
return
ref
C
ount
;
return
ref
c
ount
;
}
static
ULONG
WINAPI
ddraw_surface4_AddRef
(
IDirectDrawSurface4
*
iface
)
...
...
@@ -317,8 +328,8 @@ void ddraw_surface_destroy(IDirectDrawSurfaceImpl *This)
{
TRACE
(
"surface %p.
\n
"
,
This
);
/* Check the
ref
count and give a warning */
if
(
This
->
ref
>
1
)
/* Check the
iface
count and give a warning */
if
(
This
->
iface_count
>
1
)
{
/* This can happen when a complex surface is destroyed,
* because the 2nd surface was addref()ed when the app
...
...
@@ -423,6 +434,31 @@ static void ddraw_surface_cleanup(IDirectDrawSurfaceImpl *surface)
IUnknown_Release
(
ifaceToRelease
);
}
static
void
ddraw_surface_release_iface
(
IDirectDrawSurfaceImpl
*
This
)
{
ULONG
iface_count
=
InterlockedDecrement
(
&
This
->
iface_count
);
TRACE
(
"%p decreasing iface count to %u.
\n
"
,
This
,
iface_count
);
if
(
iface_count
==
0
)
{
/* Complex attached surfaces are destroyed implicitly when the root is released */
EnterCriticalSection
(
&
ddraw_cs
);
if
(
!
This
->
is_complex_root
)
{
WARN
(
"(%p) Attempt to destroy a surface that is not a complex root
\n
"
,
This
);
LeaveCriticalSection
(
&
ddraw_cs
);
return
;
}
if
(
This
->
wined3d_texture
)
/* If it's a texture, destroy the wined3d texture. */
wined3d_texture_decref
(
This
->
wined3d_texture
);
else
ddraw_surface_cleanup
(
This
);
LeaveCriticalSection
(
&
ddraw_cs
);
}
return
;
}
/*****************************************************************************
* IDirectDrawSurface7::Release
*
...
...
@@ -455,28 +491,16 @@ static void ddraw_surface_cleanup(IDirectDrawSurfaceImpl *surface)
static
ULONG
WINAPI
ddraw_surface7_Release
(
IDirectDrawSurface7
*
iface
)
{
IDirectDrawSurfaceImpl
*
This
=
impl_from_IDirectDrawSurface7
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
ULONG
ref
count
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"
%p decreasing refcount to %u.
\n
"
,
This
,
ref
);
TRACE
(
"
iface %p decreasing refcount to %u.
\n
"
,
iface
,
refcount
);
if
(
ref
==
0
)
if
(
ref
count
==
0
)
{
/* Complex attached surfaces are destroyed implicitly when the root is released */
EnterCriticalSection
(
&
ddraw_cs
);
if
(
!
This
->
is_complex_root
)
{
WARN
(
"(%p) Attempt to destroy a surface that is not a complex root
\n
"
,
This
);
LeaveCriticalSection
(
&
ddraw_cs
);
return
ref
;
}
if
(
This
->
wined3d_texture
)
/* If it's a texture, destroy the wined3d texture. */
wined3d_texture_decref
(
This
->
wined3d_texture
);
else
ddraw_surface_cleanup
(
This
);
LeaveCriticalSection
(
&
ddraw_cs
);
ddraw_surface_release_iface
(
This
);
}
return
ref
;
return
ref
count
;
}
static
ULONG
WINAPI
ddraw_surface4_Release
(
IDirectDrawSurface4
*
iface
)
...
...
@@ -5005,6 +5029,7 @@ HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddr
surface
->
IDirect3DTexture2_vtbl
=
&
d3d_texture2_vtbl
;
surface
->
IDirect3DTexture_vtbl
=
&
d3d_texture1_vtbl
;
surface
->
ref
=
1
;
surface
->
iface_count
=
1
;
surface
->
version
=
version
;
surface
->
ddraw
=
ddraw
;
...
...
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