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
ab86a9e5
Commit
ab86a9e5
authored
Sep 19, 2000
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Henning Hoffmann
Avoid deadlocks in EnumMetaFile.
parent
9005713d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
8 deletions
+27
-8
metafile.c
objects/metafile.c
+27
-8
No files found.
objects/metafile.c
View file @
ab86a9e5
...
...
@@ -658,10 +658,10 @@ BOOL WINAPI EnumMetaFile(
MFENUMPROC
lpEnumFunc
,
LPARAM
lpData
)
{
METAHEADER
*
mh
=
MF_GetMetaHeader
(
hmf
);
METAHEADER
*
mh
Temp
=
NULL
,
*
mh
=
MF_GetMetaHeader
(
hmf
);
METARECORD
*
mr
;
HANDLETABLE
*
ht
;
BOOL
result
=
TRUE
,
loaded
=
FALSE
;
BOOL
result
=
TRUE
;
int
i
,
offset
=
0
;
HPEN
hPen
;
HBRUSH
hBrush
;
...
...
@@ -671,10 +671,30 @@ BOOL WINAPI EnumMetaFile(
hdc
,
hmf
,
lpEnumFunc
,
(
void
*
)
lpData
);
if
(
!
mh
)
return
0
;
if
(
mh
->
mtType
==
METAFILE_DISK
)
{
/* Create a memory-based copy */
mh
=
MF_LoadDiskBasedMetaFile
(
mh
);
if
(
!
mh
)
return
0
;
loaded
=
TRUE
;
mhTemp
=
MF_LoadDiskBasedMetaFile
(
mh
);
if
(
!
mhTemp
)
{
MF_ReleaseMetaHeader
(
hmf
);
return
FALSE
;
}
mh
=
mhTemp
;
}
else
{
/* We need to copy this thing instead of use it directly because we
* have to close the hmf handle for the purpose of avoiding deadlock.
*/
mhTemp
=
HeapAlloc
(
GetProcessHeap
(),
0
,
mh
->
mtHeaderSize
+
mh
->
mtSize
*
2
);
if
(
!
mhTemp
)
{
MF_ReleaseMetaHeader
(
hmf
);
return
FALSE
;
}
memcpy
(
mhTemp
,
mh
,
mh
->
mtHeaderSize
+
mh
->
mtSize
*
2
);
mh
=
mhTemp
;
}
MF_ReleaseMetaHeader
(
hmf
);
hmf
=
0
;
/* just in case */
/* save the current pen, brush and font */
hPen
=
GetCurrentObject
(
hdc
,
OBJ_PEN
);
...
...
@@ -713,9 +733,8 @@ BOOL WINAPI EnumMetaFile(
/* free handle table */
HeapFree
(
GetProcessHeap
(),
0
,
ht
);
if
(
loaded
)
HeapFree
(
GetProcessHeap
(),
0
,
mh
);
MF_ReleaseMetaHeader
(
hmf
);
/* free a copy of metafile */
HeapFree
(
GetProcessHeap
(),
0
,
mh
);
return
result
;
}
...
...
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