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
8dc9e878
Commit
8dc9e878
authored
May 06, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Don't store the display driver in the global list to avoid the need for locking.
parent
0e4f742f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
21 deletions
+27
-21
driver.c
dlls/gdi32/driver.c
+27
-21
No files found.
dlls/gdi32/driver.c
View file @
8dc9e878
...
...
@@ -209,7 +209,6 @@ static struct graphics_driver *create_driver( HMODULE module )
}
else
memset
(
&
driver
->
funcs
,
0
,
sizeof
(
driver
->
funcs
)
);
list_add_head
(
&
drivers
,
&
driver
->
entry
);
return
driver
;
}
...
...
@@ -221,6 +220,7 @@ static struct graphics_driver *create_driver( HMODULE module )
*/
static
struct
graphics_driver
*
load_display_driver
(
void
)
{
struct
graphics_driver
*
driver
;
char
buffer
[
MAX_PATH
],
libname
[
32
],
*
name
,
*
next
;
HMODULE
module
=
0
;
HKEY
hkey
;
...
...
@@ -247,13 +247,18 @@ static struct graphics_driver *load_display_driver(void)
name
=
next
;
}
if
(
!
(
d
isplay_d
river
=
create_driver
(
module
)))
if
(
!
(
driver
=
create_driver
(
module
)))
{
MESSAGE
(
"Could not create graphics driver '%s'
\n
"
,
buffer
);
FreeLibrary
(
module
);
ExitProcess
(
1
);
}
if
(
InterlockedCompareExchangePointer
(
(
void
**
)
&
display_driver
,
driver
,
NULL
))
{
/* somebody beat us to it */
FreeLibrary
(
driver
->
module
);
HeapFree
(
GetProcessHeap
(),
0
,
driver
);
}
return
display_driver
;
}
...
...
@@ -264,47 +269,48 @@ static struct graphics_driver *load_display_driver(void)
const
DC_FUNCTIONS
*
DRIVER_load_driver
(
LPCWSTR
name
)
{
HMODULE
module
;
struct
graphics_driver
*
driver
;
struct
graphics_driver
*
driver
,
*
new_driver
;
static
const
WCHAR
displayW
[]
=
{
'd'
,
'i'
,
's'
,
'p'
,
'l'
,
'a'
,
'y'
,
0
};
static
const
WCHAR
display1W
[]
=
{
'\\'
,
'\\'
,
'.'
,
'\\'
,
'D'
,
'I'
,
'S'
,
'P'
,
'L'
,
'A'
,
'Y'
,
'1'
,
0
};
EnterCriticalSection
(
&
driver_section
);
/* display driver is a special case */
if
(
!
strcmpiW
(
name
,
displayW
)
||
!
strcmpiW
(
name
,
display1W
))
if
(
!
strcmpiW
(
name
,
displayW
)
||
!
strcmpiW
(
name
,
display1W
))
{
driver
=
load_display_driver
();
LeaveCriticalSection
(
&
driver_section
);
return
&
driver
->
funcs
;
}
if
((
module
=
GetModuleHandleW
(
name
)))
{
if
(
display_driver
&&
display_driver
->
module
==
module
)
return
&
display_driver
->
funcs
;
EnterCriticalSection
(
&
driver_section
);
LIST_FOR_EACH_ENTRY
(
driver
,
&
drivers
,
struct
graphics_driver
,
entry
)
{
if
(
driver
->
module
==
module
)
{
LeaveCriticalSection
(
&
driver_section
);
return
&
driver
->
funcs
;
}
if
(
driver
->
module
==
module
)
goto
done
;
}
LeaveCriticalSection
(
&
driver_section
);
}
if
(
!
(
module
=
LoadLibraryW
(
name
)))
if
(
!
(
module
=
LoadLibraryW
(
name
)))
return
NULL
;
if
(
!
(
new_driver
=
create_driver
(
module
)))
{
LeaveCriticalSection
(
&
driver_section
);
FreeLibrary
(
module
);
return
NULL
;
}
if
(
!
(
driver
=
create_driver
(
module
)))
/* check if someone else added it in the meantime */
EnterCriticalSection
(
&
driver_section
);
LIST_FOR_EACH_ENTRY
(
driver
,
&
drivers
,
struct
graphics_driver
,
entry
)
{
if
(
driver
->
module
!=
module
)
continue
;
FreeLibrary
(
module
);
LeaveCriticalSection
(
&
driver_section
);
return
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
new_driver
);
goto
done
;
}
driver
=
new_driver
;
list_add_head
(
&
drivers
,
&
driver
->
entry
);
TRACE
(
"loaded driver %p for %s
\n
"
,
driver
,
debugstr_w
(
name
)
);
done:
LeaveCriticalSection
(
&
driver_section
);
return
&
driver
->
funcs
;
}
...
...
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