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
9d5c801d
Commit
9d5c801d
authored
Sep 27, 2019
by
Piotr Caban
Committed by
Alexandre Julliard
Sep 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebus.sys: Stop SDL deviceloop_thread to avoid crash on driver unload.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
485aed9f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
6 deletions
+37
-6
bus_sdl.c
dlls/winebus.sys/bus_sdl.c
+37
-6
No files found.
dlls/winebus.sys/bus_sdl.c
View file @
9d5c801d
...
...
@@ -70,6 +70,8 @@ static DWORD map_controllers = 0;
DEFINE_GUID
(
GUID_DEVCLASS_SDL
,
0x463d60b5
,
0x802b
,
0x4bb2
,
0x8f
,
0xdb
,
0x7d
,
0xa9
,
0xb9
,
0x96
,
0x04
,
0xd8
);
static
void
*
sdl_handle
=
NULL
;
static
HANDLE
deviceloop_handle
;
static
UINT
quit_event
=
-
1
;
#ifdef SONAME_LIBSDL2
#define MAKE_FUNCPTR(f) static typeof(f) * p##f = NULL
...
...
@@ -109,6 +111,8 @@ MAKE_FUNCPTR(SDL_HapticStopAll);
MAKE_FUNCPTR
(
SDL_JoystickIsHaptic
);
MAKE_FUNCPTR
(
SDL_memset
);
MAKE_FUNCPTR
(
SDL_GameControllerAddMapping
);
MAKE_FUNCPTR
(
SDL_RegisterEvents
);
MAKE_FUNCPTR
(
SDL_PushEvent
);
#endif
static
Uint16
(
*
pSDL_JoystickGetProduct
)(
SDL_Joystick
*
joystick
);
static
Uint16
(
*
pSDL_JoystickGetProductVersion
)(
SDL_Joystick
*
joystick
);
...
...
@@ -1075,17 +1079,41 @@ static DWORD CALLBACK deviceloop_thread(void *args)
SetEvent
(
init_done
);
while
(
1
)
while
(
pSDL_WaitEvent
(
&
event
)
!=
0
)
while
(
1
)
{
while
(
pSDL_WaitEvent
(
&
event
)
!=
0
)
{
if
(
event
.
type
==
quit_event
)
{
TRACE
(
"Device thread exiting
\n
"
);
return
0
;
}
process_device_event
(
&
event
);
TRACE
(
"Device thread exiting
\n
"
);
return
0
;
}
}
}
void
sdl_driver_unload
(
void
)
{
SDL_Event
event
;
TRACE
(
"Unload Driver
\n
"
);
if
(
!
deviceloop_handle
)
return
;
quit_event
=
pSDL_RegisterEvents
(
1
);
if
(
quit_event
==
-
1
)
{
ERR
(
"error registering quit event
\n
"
);
return
;
}
event
.
type
=
quit_event
;
if
(
pSDL_PushEvent
(
&
event
)
!=
1
)
{
ERR
(
"error pushing quit event
\n
"
);
return
;
}
WaitForSingleObject
(
deviceloop_handle
,
INFINITE
);
CloseHandle
(
deviceloop_handle
);
wine_dlclose
(
sdl_handle
,
NULL
,
0
);
}
NTSTATUS
sdl_driver_init
(
void
)
...
...
@@ -1140,6 +1168,8 @@ NTSTATUS sdl_driver_init(void)
LOAD_FUNCPTR
(
SDL_JoystickIsHaptic
);
LOAD_FUNCPTR
(
SDL_memset
);
LOAD_FUNCPTR
(
SDL_GameControllerAddMapping
);
LOAD_FUNCPTR
(
SDL_RegisterEvents
);
LOAD_FUNCPTR
(
SDL_PushEvent
);
#undef LOAD_FUNCPTR
pSDL_JoystickGetProduct
=
wine_dlsym
(
sdl_handle
,
"SDL_JoystickGetProduct"
,
NULL
,
0
);
pSDL_JoystickGetProductVersion
=
wine_dlsym
(
sdl_handle
,
"SDL_JoystickGetProductVersion"
,
NULL
,
0
);
...
...
@@ -1162,12 +1192,13 @@ NTSTATUS sdl_driver_init(void)
result
=
WaitForMultipleObjects
(
2
,
events
,
FALSE
,
INFINITE
);
CloseHandle
(
events
[
0
]);
CloseHandle
(
events
[
1
]);
if
(
result
==
WAIT_OBJECT_0
)
{
TRACE
(
"Initialization successful
\n
"
);
deviceloop_handle
=
events
[
1
];
return
STATUS_SUCCESS
;
}
CloseHandle
(
events
[
1
]);
sym_not_found:
wine_dlclose
(
sdl_handle
,
NULL
,
0
);
...
...
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