Commit 686ea70c authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

coreaudio: Make sure Port_SendToMessageThread is not NULL before calling CFMessagePortSendRequest.

Prevents crashing when closing audio device during playback.
parent 031ee3e6
...@@ -349,6 +349,9 @@ static void wodSendNotifyCompletionsMessage(WINE_WAVEOUT* wwo) ...@@ -349,6 +349,9 @@ static void wodSendNotifyCompletionsMessage(WINE_WAVEOUT* wwo)
CFDataRef data; CFDataRef data;
UInt32 buffer; UInt32 buffer;
if (!Port_SendToMessageThread)
return;
buffer = (UInt32) wwo->woID; buffer = (UInt32) wwo->woID;
data = CFDataCreate(kCFAllocatorDefault, (UInt8 *)&buffer, sizeof(buffer)); data = CFDataCreate(kCFAllocatorDefault, (UInt8 *)&buffer, sizeof(buffer));
...@@ -368,6 +371,9 @@ static void wodSendNotifyInputCompletionsMessage(WINE_WAVEIN* wwi) ...@@ -368,6 +371,9 @@ static void wodSendNotifyInputCompletionsMessage(WINE_WAVEIN* wwi)
CFDataRef data; CFDataRef data;
UInt32 buffer; UInt32 buffer;
if (!Port_SendToMessageThread)
return;
buffer = (UInt32) wwi->wiID; buffer = (UInt32) wwi->wiID;
data = CFDataCreate(kCFAllocatorDefault, (UInt8 *)&buffer, sizeof(buffer)); data = CFDataCreate(kCFAllocatorDefault, (UInt8 *)&buffer, sizeof(buffer));
...@@ -694,6 +700,9 @@ void CoreAudio_WaveRelease(void) ...@@ -694,6 +700,9 @@ void CoreAudio_WaveRelease(void)
/* Stop CFRunLoop in messageThread */ /* Stop CFRunLoop in messageThread */
TRACE("()\n"); TRACE("()\n");
if (!Port_SendToMessageThread)
return;
CFMessagePortSendRequest(Port_SendToMessageThread, kStopLoopMessage, NULL, 0.0, 0.0, NULL, NULL); CFMessagePortSendRequest(Port_SendToMessageThread, kStopLoopMessage, NULL, 0.0, 0.0, NULL, NULL);
CFRelease(Port_SendToMessageThread); CFRelease(Port_SendToMessageThread);
Port_SendToMessageThread = NULL; Port_SendToMessageThread = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment