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
4ff712c9
Commit
4ff712c9
authored
Oct 09, 2006
by
Stefan Dösinger
Committed by
Alexandre Julliard
Oct 09, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Remove the process counter.
parent
3543a070
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
61 deletions
+53
-61
main.c
dlls/ddraw/main.c
+53
-61
No files found.
dlls/ddraw/main.c
View file @
4ff712c9
...
@@ -812,8 +812,6 @@ DllMain(HINSTANCE hInstDLL,
...
@@ -812,8 +812,6 @@ DllMain(HINSTANCE hInstDLL,
DWORD
Reason
,
DWORD
Reason
,
void
*
lpv
)
void
*
lpv
)
{
{
static
LONG
counter
=
0
;
TRACE
(
"(%p,%lx,%p)
\n
"
,
hInstDLL
,
Reason
,
lpv
);
TRACE
(
"(%p,%lx,%p)
\n
"
,
hInstDLL
,
Reason
,
lpv
);
if
(
Reason
==
DLL_PROCESS_ATTACH
)
if
(
Reason
==
DLL_PROCESS_ATTACH
)
{
{
...
@@ -865,73 +863,67 @@ DllMain(HINSTANCE hInstDLL,
...
@@ -865,73 +863,67 @@ DllMain(HINSTANCE hInstDLL,
}
}
DisableThreadLibraryCalls
(
hInstDLL
);
DisableThreadLibraryCalls
(
hInstDLL
);
TRACE
(
"Attach counter: %ld
\n
"
,
InterlockedIncrement
(
&
counter
));
}
}
else
if
(
Reason
==
DLL_PROCESS_DETACH
)
else
if
(
Reason
==
DLL_PROCESS_DETACH
)
{
{
TRACE
(
"Attach counter: %ld
\n
"
,
InterlockedDecrement
(
&
counter
));
if
(
!
list_empty
(
&
global_ddraw_list
))
if
(
counter
==
0
)
{
{
if
(
!
list_empty
(
&
global_ddraw_list
))
struct
list
*
entry
,
*
entry2
;
WARN
(
"There are still existing DirectDraw interfaces. Wine bug or buggy application?
\n
"
);
/* We remove elemets from this loop */
LIST_FOR_EACH_SAFE
(
entry
,
entry2
,
&
global_ddraw_list
)
{
{
struct
list
*
entry
,
*
entry2
;
HRESULT
hr
;
WARN
(
"There are still existing DirectDraw interfaces. Wine bug or buggy application?
\n
"
);
DDSURFACEDESC2
desc
;
int
i
;
IDirectDrawImpl
*
ddraw
=
LIST_ENTRY
(
entry
,
IDirectDrawImpl
,
ddraw_list_entry
);
WARN
(
"DDraw %p has a refcount of %ld
\n
"
,
ddraw
,
ddraw
->
ref7
+
ddraw
->
ref4
+
ddraw
->
ref2
+
ddraw
->
ref1
);
/* Add references to each interface to avoid freeing them unexpectadely */
IDirectDraw_AddRef
(
ICOM_INTERFACE
(
ddraw
,
IDirectDraw
));
IDirectDraw2_AddRef
(
ICOM_INTERFACE
(
ddraw
,
IDirectDraw2
));
IDirectDraw4_AddRef
(
ICOM_INTERFACE
(
ddraw
,
IDirectDraw4
));
IDirectDraw7_AddRef
(
ICOM_INTERFACE
(
ddraw
,
IDirectDraw7
));
/* Does a D3D device exist? Destroy it
* TODO: Destroy all Vertex buffers, Lights, Materials
* and execture buffers too
*/
if
(
ddraw
->
d3ddevice
)
{
WARN
(
"DDraw %p has d3ddevice %p attached
\n
"
,
ddraw
,
ddraw
->
d3ddevice
);
while
(
IDirect3DDevice7_Release
(
ICOM_INTERFACE
(
ddraw
->
d3ddevice
,
IDirect3DDevice7
)));
}
/* We remove elemets from this loop */
/* Try to release the objects
LIST_FOR_EACH_SAFE
(
entry
,
entry2
,
&
global_ddraw_list
)
* Do an EnumSurfaces to find any hanging surfaces
*/
memset
(
&
desc
,
0
,
sizeof
(
desc
));
desc
.
dwSize
=
sizeof
(
desc
);
for
(
i
=
0
;
i
<=
1
;
i
++
)
{
{
HRESULT
hr
;
hr
=
IDirectDraw7_EnumSurfaces
(
ICOM_INTERFACE
(
ddraw
,
IDirectDraw7
),
DDSURFACEDESC2
desc
;
DDENUMSURFACES_ALL
,
int
i
;
&
desc
,
IDirectDrawImpl
*
ddraw
=
LIST_ENTRY
(
entry
,
IDirectDrawImpl
,
ddraw_list_entry
);
(
void
*
)
ddraw
,
DestroyCallback
);
WARN
(
"DDraw %p has a refcount of %ld
\n
"
,
ddraw
,
ddraw
->
ref7
+
ddraw
->
ref4
+
ddraw
->
ref2
+
ddraw
->
ref1
);
if
(
hr
!=
D3D_OK
)
ERR
(
"(%p) EnumSurfaces failed, prepare for trouble
\n
"
,
ddraw
);
/* Add references to each interface to avoid freeing them unexpectadely */
IDirectDraw_AddRef
(
ICOM_INTERFACE
(
ddraw
,
IDirectDraw
));
IDirectDraw2_AddRef
(
ICOM_INTERFACE
(
ddraw
,
IDirectDraw2
));
IDirectDraw4_AddRef
(
ICOM_INTERFACE
(
ddraw
,
IDirectDraw4
));
IDirectDraw7_AddRef
(
ICOM_INTERFACE
(
ddraw
,
IDirectDraw7
));
/* Does a D3D device exist? Destroy it
* TODO: Destroy all Vertex buffers, Lights, Materials
* and execture buffers too
*/
if
(
ddraw
->
d3ddevice
)
{
WARN
(
"DDraw %p has d3ddevice %p attached
\n
"
,
ddraw
,
ddraw
->
d3ddevice
);
while
(
IDirect3DDevice7_Release
(
ICOM_INTERFACE
(
ddraw
->
d3ddevice
,
IDirect3DDevice7
)));
}
/* Try to release the objects
* Do an EnumSurfaces to find any hanging surfaces
*/
memset
(
&
desc
,
0
,
sizeof
(
desc
));
desc
.
dwSize
=
sizeof
(
desc
);
for
(
i
=
0
;
i
<=
1
;
i
++
)
{
hr
=
IDirectDraw7_EnumSurfaces
(
ICOM_INTERFACE
(
ddraw
,
IDirectDraw7
),
DDENUMSURFACES_ALL
,
&
desc
,
(
void
*
)
ddraw
,
DestroyCallback
);
if
(
hr
!=
D3D_OK
)
ERR
(
"(%p) EnumSurfaces failed, prepare for trouble
\n
"
,
ddraw
);
}
/* Check the surface count */
if
(
ddraw
->
surfaces
>
0
)
ERR
(
"DDraw %p still has %ld surfaces attached
\n
"
,
ddraw
,
ddraw
->
surfaces
);
/* Release all hanging references to destroy the objects. This
* restores the screen mode too
*/
while
(
IDirectDraw_Release
(
ICOM_INTERFACE
(
ddraw
,
IDirectDraw
)));
while
(
IDirectDraw2_Release
(
ICOM_INTERFACE
(
ddraw
,
IDirectDraw2
)));
while
(
IDirectDraw4_Release
(
ICOM_INTERFACE
(
ddraw
,
IDirectDraw4
)));
while
(
IDirectDraw7_Release
(
ICOM_INTERFACE
(
ddraw
,
IDirectDraw7
)));
}
}
/* Check the surface count */
if
(
ddraw
->
surfaces
>
0
)
ERR
(
"DDraw %p still has %ld surfaces attached
\n
"
,
ddraw
,
ddraw
->
surfaces
);
/* Release all hanging references to destroy the objects. This
* restores the screen mode too
*/
while
(
IDirectDraw_Release
(
ICOM_INTERFACE
(
ddraw
,
IDirectDraw
)));
while
(
IDirectDraw2_Release
(
ICOM_INTERFACE
(
ddraw
,
IDirectDraw2
)));
while
(
IDirectDraw4_Release
(
ICOM_INTERFACE
(
ddraw
,
IDirectDraw4
)));
while
(
IDirectDraw7_Release
(
ICOM_INTERFACE
(
ddraw
,
IDirectDraw7
)));
}
}
}
}
}
}
...
...
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