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
4e2c87dd
Commit
4e2c87dd
authored
Mar 09, 2009
by
Henri Verbeet
Committed by
Alexandre Julliard
Mar 09, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Handle error conditions better in RemoveContextFromArray().
parent
695c69f6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
18 deletions
+37
-18
context.c
dlls/wined3d/context.c
+37
-18
No files found.
dlls/wined3d/context.c
View file @
4e2c87dd
...
...
@@ -919,31 +919,50 @@ out:
*
*****************************************************************************/
static
void
RemoveContextFromArray
(
IWineD3DDeviceImpl
*
This
,
WineD3DContext
*
context
)
{
UINT
t
,
s
;
WineD3DContext
**
oldArray
=
This
->
contexts
;
WineD3DContext
**
new_array
;
BOOL
found
=
FALSE
;
UINT
i
;
TRACE
(
"Removing ctx %p
\n
"
,
context
);
This
->
numContexts
--
;
if
(
This
->
numContexts
)
{
This
->
contexts
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
This
->
contexts
)
*
This
->
numContexts
);
if
(
!
This
->
contexts
)
{
ERR
(
"Cannot allocate a new context array, PANIC!!!
\n
"
);
}
t
=
0
;
/* Note that we decreased numContexts a few lines up, so use '<=' instead of '<' */
for
(
s
=
0
;
s
<=
This
->
numContexts
;
s
++
)
{
if
(
oldArray
[
s
]
==
context
)
continue
;
This
->
contexts
[
t
]
=
oldArray
[
s
];
t
++
;
for
(
i
=
0
;
i
<
This
->
numContexts
;
++
i
)
{
if
(
This
->
contexts
[
i
]
==
context
)
{
HeapFree
(
GetProcessHeap
(),
0
,
context
);
found
=
TRUE
;
break
;
}
}
else
{
}
if
(
!
found
)
{
ERR
(
"Context %p doesn't exist in context array
\n
"
,
context
);
return
;
}
while
(
i
<
This
->
numContexts
-
1
)
{
This
->
contexts
[
i
]
=
This
->
contexts
[
i
+
1
];
++
i
;
}
--
This
->
numContexts
;
if
(
!
This
->
numContexts
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
->
contexts
);
This
->
contexts
=
NULL
;
return
;
}
HeapFree
(
GetProcessHeap
(),
0
,
context
);
HeapFree
(
GetProcessHeap
(),
0
,
oldArray
);
new_array
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
This
->
contexts
,
This
->
numContexts
*
sizeof
(
*
This
->
contexts
));
if
(
!
new_array
)
{
ERR
(
"Failed to shrink context array. Oh well.
\n
"
);
return
;
}
This
->
contexts
=
new_array
;
}
/*****************************************************************************
...
...
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