From 686ea70c1853aecc235143862b42e6fb09333ed4 Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Thu, 10 Jul 2008 11:28:56 +0900 Subject: [PATCH] coreaudio: Make sure Port_SendToMessageThread is not NULL before calling CFMessagePortSendRequest. Prevents crashing when closing audio device during playback. --- dlls/winecoreaudio.drv/audio.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dlls/winecoreaudio.drv/audio.c b/dlls/winecoreaudio.drv/audio.c index 90d664f0ab3..549b69e62db 100644 --- a/dlls/winecoreaudio.drv/audio.c +++ b/dlls/winecoreaudio.drv/audio.c @@ -349,6 +349,9 @@ static void wodSendNotifyCompletionsMessage(WINE_WAVEOUT* wwo) CFDataRef data; UInt32 buffer; + if (!Port_SendToMessageThread) + return; + buffer = (UInt32) wwo->woID; data = CFDataCreate(kCFAllocatorDefault, (UInt8 *)&buffer, sizeof(buffer)); @@ -368,6 +371,9 @@ static void wodSendNotifyInputCompletionsMessage(WINE_WAVEIN* wwi) CFDataRef data; UInt32 buffer; + if (!Port_SendToMessageThread) + return; + buffer = (UInt32) wwi->wiID; data = CFDataCreate(kCFAllocatorDefault, (UInt8 *)&buffer, sizeof(buffer)); @@ -694,6 +700,9 @@ void CoreAudio_WaveRelease(void) /* Stop CFRunLoop in messageThread */ TRACE("()\n"); + if (!Port_SendToMessageThread) + return; + CFMessagePortSendRequest(Port_SendToMessageThread, kStopLoopMessage, NULL, 0.0, 0.0, NULL, NULL); CFRelease(Port_SendToMessageThread); Port_SendToMessageThread = NULL; -- 2.11.4.GIT