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
3ad89896
Commit
3ad89896
authored
Nov 04, 2013
by
Henri Verbeet
Committed by
Alexandre Julliard
Nov 04, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Introduce a function for safely releasing a DC.
parent
6d7bd62a
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
22 deletions
+22
-22
context.c
dlls/wined3d/context.c
+4
-20
directx.c
dlls/wined3d/directx.c
+1
-1
swapchain.c
dlls/wined3d/swapchain.c
+1
-1
utils.c
dlls/wined3d/utils.c
+14
-0
wined3d_private.h
dlls/wined3d/wined3d_private.h
+2
-0
No files found.
dlls/wined3d/context.c
View file @
3ad89896
...
@@ -844,25 +844,9 @@ static void context_update_window(struct wined3d_context *context)
...
@@ -844,25 +844,9 @@ static void context_update_window(struct wined3d_context *context)
context
,
context
->
win_handle
,
context
->
swapchain
->
win_handle
);
context
,
context
->
win_handle
,
context
->
swapchain
->
win_handle
);
if
(
context
->
valid
)
if
(
context
->
valid
)
{
wined3d_release_dc
(
context
->
win_handle
,
context
->
hdc
);
/* You'd figure ReleaseDC() would fail if the DC doesn't match the
else
* window. However, that's not what actually happens, and there are
context
->
valid
=
1
;
* user32 tests that confirm ReleaseDC() with the wrong window is
* supposed to succeed. So explicitly check that the DC belongs to
* the window, since we want to avoid releasing a DC that belongs to
* some other window if the original window was already destroyed. */
if
(
WindowFromDC
(
context
->
hdc
)
!=
context
->
win_handle
)
{
WARN
(
"DC %p does not belong to window %p.
\n
"
,
context
->
hdc
,
context
->
win_handle
);
}
else
if
(
!
ReleaseDC
(
context
->
win_handle
,
context
->
hdc
))
{
ERR
(
"Failed to release device context %p, last error %#x.
\n
"
,
context
->
hdc
,
GetLastError
());
}
}
else
context
->
valid
=
1
;
context
->
win_handle
=
context
->
swapchain
->
win_handle
;
context
->
win_handle
=
context
->
swapchain
->
win_handle
;
...
@@ -987,7 +971,7 @@ static void context_destroy_gl_resources(struct wined3d_context *context)
...
@@ -987,7 +971,7 @@ static void context_destroy_gl_resources(struct wined3d_context *context)
ERR
(
"Failed to disable GL context.
\n
"
);
ERR
(
"Failed to disable GL context.
\n
"
);
}
}
ReleaseDC
(
context
->
win_handle
,
context
->
hdc
);
wined3d_release_dc
(
context
->
win_handle
,
context
->
hdc
);
if
(
!
wglDeleteContext
(
context
->
glCtx
))
if
(
!
wglDeleteContext
(
context
->
glCtx
))
{
{
...
...
dlls/wined3d/directx.c
View file @
3ad89896
...
@@ -277,7 +277,7 @@ static void wined3d_caps_gl_ctx_destroy(const struct wined3d_caps_gl_ctx *ctx)
...
@@ -277,7 +277,7 @@ static void wined3d_caps_gl_ctx_destroy(const struct wined3d_caps_gl_ctx *ctx)
ERR
(
"wglDeleteContext(%p) failed, last error %#x.
\n
"
,
ctx
->
gl_ctx
,
err
);
ERR
(
"wglDeleteContext(%p) failed, last error %#x.
\n
"
,
ctx
->
gl_ctx
,
err
);
}
}
ReleaseDC
(
ctx
->
wnd
,
ctx
->
dc
);
wined3d_release_dc
(
ctx
->
wnd
,
ctx
->
dc
);
DestroyWindow
(
ctx
->
wnd
);
DestroyWindow
(
ctx
->
wnd
);
if
(
ctx
->
restore_gl_ctx
&&
!
wglMakeCurrent
(
ctx
->
restore_dc
,
ctx
->
restore_gl_ctx
))
if
(
ctx
->
restore_gl_ctx
&&
!
wglMakeCurrent
(
ctx
->
restore_dc
,
ctx
->
restore_gl_ctx
))
...
...
dlls/wined3d/swapchain.c
View file @
3ad89896
...
@@ -83,7 +83,7 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain)
...
@@ -83,7 +83,7 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain)
{
{
TRACE
(
"Destroying backup wined3d window %p, dc %p.
\n
"
,
swapchain
->
backup_wnd
,
swapchain
->
backup_dc
);
TRACE
(
"Destroying backup wined3d window %p, dc %p.
\n
"
,
swapchain
->
backup_wnd
,
swapchain
->
backup_dc
);
ReleaseDC
(
swapchain
->
backup_wnd
,
swapchain
->
backup_dc
);
wined3d_release_dc
(
swapchain
->
backup_wnd
,
swapchain
->
backup_dc
);
DestroyWindow
(
swapchain
->
backup_wnd
);
DestroyWindow
(
swapchain
->
backup_wnd
);
}
}
}
}
...
...
dlls/wined3d/utils.c
View file @
3ad89896
...
@@ -3852,3 +3852,17 @@ void wined3d_ftoa(float value, char *s)
...
@@ -3852,3 +3852,17 @@ void wined3d_ftoa(float value, char *s)
sprintf
(
s
,
"%s%d.%08de%+03d"
,
sign
,
x
,
frac
,
exponent
);
sprintf
(
s
,
"%s%d.%08de%+03d"
,
sign
,
x
,
frac
,
exponent
);
}
}
void
wined3d_release_dc
(
HWND
window
,
HDC
dc
)
{
/* You'd figure ReleaseDC() would fail if the DC doesn't match the window.
* However, that's not what actually happens, and there are user32 tests
* that confirm ReleaseDC() with the wrong window is supposed to succeed.
* So explicitly check that the DC belongs to the window, since we want to
* avoid releasing a DC that belongs to some other window if the original
* window was already destroyed. */
if
(
WindowFromDC
(
dc
)
!=
window
)
WARN
(
"DC %p does not belong to window %p.
\n
"
,
dc
,
window
);
else
if
(
!
ReleaseDC
(
window
,
dc
))
ERR
(
"Failed to release device context %p, last error %#x.
\n
"
,
dc
,
GetLastError
());
}
dlls/wined3d/wined3d_private.h
View file @
3ad89896
...
@@ -2742,6 +2742,8 @@ void multiply_matrix(struct wined3d_matrix *dest, const struct wined3d_matrix *s
...
@@ -2742,6 +2742,8 @@ void multiply_matrix(struct wined3d_matrix *dest, const struct wined3d_matrix *s
UINT
wined3d_log2i
(
UINT32
x
)
DECLSPEC_HIDDEN
;
UINT
wined3d_log2i
(
UINT32
x
)
DECLSPEC_HIDDEN
;
unsigned
int
count_bits
(
unsigned
int
mask
)
DECLSPEC_HIDDEN
;
unsigned
int
count_bits
(
unsigned
int
mask
)
DECLSPEC_HIDDEN
;
void
wined3d_release_dc
(
HWND
window
,
HDC
dc
)
DECLSPEC_HIDDEN
;
struct
wined3d_shader_lconst
struct
wined3d_shader_lconst
{
{
struct
list
entry
;
struct
list
entry
;
...
...
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