Jörg Höhle : winealsa: Open must fail when recorder thread creation fails.
Alexandre Julliard
julliard at winehq.org
Tue Mar 15 11:33:58 CDT 2011
Module: wine
Branch: master
Commit: 04e3bda4104d7151cf0c1e676e7ffe39c3430f4c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=04e3bda4104d7151cf0c1e676e7ffe39c3430f4c
Author: Jörg Höhle <hoehle at users.sourceforge.net>
Date: Sun Mar 6 23:03:52 2011 +0100
winealsa: Open must fail when recorder thread creation fails.
---
dlls/winealsa.drv/wavein.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/dlls/winealsa.drv/wavein.c b/dlls/winealsa.drv/wavein.c
index daf73be..f92f18d 100644
--- a/dlls/winealsa.drv/wavein.c
+++ b/dlls/winealsa.drv/wavein.c
@@ -511,8 +511,13 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
wwi->hStartUpEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
wwi->hThread = CreateThread(NULL, 0, widRecorder, (LPVOID)(DWORD_PTR)wDevID, 0, &(wwi->dwThreadID));
- if (wwi->hThread)
- SetThreadPriority(wwi->hThread, THREAD_PRIORITY_TIME_CRITICAL);
+ if (!wwi->hThread) {
+ ERR("Thread creation for the widRecorder failed!\n");
+ CloseHandle(wwi->hStartUpEvent);
+ ret = MMSYSERR_NOMEM;
+ goto error;
+ }
+ SetThreadPriority(wwi->hThread, THREAD_PRIORITY_TIME_CRITICAL);
WaitForSingleObject(wwi->hStartUpEvent, INFINITE);
CloseHandle(wwi->hStartUpEvent);
wwi->hStartUpEvent = NULL;
@@ -525,6 +530,8 @@ error:
snd_pcm_close(pcm);
HeapFree( GetProcessHeap(), 0, hw_params );
HeapFree( GetProcessHeap(), 0, sw_params );
+ if (wwi->msgRing.ring_buffer_size > 0)
+ ALSA_DestroyRingMessage(&wwi->msgRing);
return ret;
}
More information about the wine-cvs
mailing list