[PATCH 1/1] mciqtz32: Fix thread handle leak if a second play.
Akihiro Sagawa
wine at gitlab.winehq.org
Tue Jul 5 07:42:44 CDT 2022
From: Akihiro Sagawa <sagawa.aki at gmail.com>
Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>
---
dlls/mciqtz32/mciqtz.c | 11 +++++++----
dlls/winmm/tests/mci.c | 13 +++++++++++++
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/dlls/mciqtz32/mciqtz.c b/dlls/mciqtz32/mciqtz.c
index a7ec0b78f33..5bde3f5dd14 100644
--- a/dlls/mciqtz32/mciqtz.c
+++ b/dlls/mciqtz32/mciqtz.c
@@ -449,10 +449,13 @@ static DWORD MCIQTZ_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
IVideoWindow_put_Visible(wma->vidwin, OATRUE);
- wma->thread = CreateThread(NULL, 0, MCIQTZ_notifyThread, wma, 0, NULL);
- if (!wma->thread) {
- TRACE("Can't create thread\n");
- return MCIERR_INTERNAL;
+ if (!wma->thread)
+ {
+ wma->thread = CreateThread(NULL, 0, MCIQTZ_notifyThread, wma, 0, NULL);
+ if (!wma->thread) {
+ TRACE("Can't create thread\n");
+ return MCIERR_INTERNAL;
+ }
}
return 0;
}
diff --git a/dlls/winmm/tests/mci.c b/dlls/winmm/tests/mci.c
index cfad9a77da8..2e31cf51708 100644
--- a/dlls/winmm/tests/mci.c
+++ b/dlls/winmm/tests/mci.c
@@ -1336,6 +1336,19 @@ static void test_playWaveTypeMpegvideo(void)
err = mciSendStringA("close mysound", NULL, 0, NULL);
ok(!err,"mci close returned %s\n", dbg_mcierr(err));
+
+ /* test a second play */
+ err = mciSendStringA("open tempfile.wav type MPEGVideo alias mysound", NULL, 0, NULL);
+ ok(err==ok_saved,"mci open tempfile.wav type MPEGVideo returned %s\n", dbg_mcierr(err));
+
+ err = mciSendStringA("play mysound", NULL, 0, NULL);
+ ok(!err,"mci play retuend %s\n", dbg_mcierr(err));
+
+ err = mciSendStringA("play mysound", NULL, 0, NULL);
+ ok(!err,"mci play retuend %s\n", dbg_mcierr(err));
+
+ err = mciSendStringA("close mysound", NULL, 0, NULL);
+ ok(!err,"mci close returned %s\n", dbg_mcierr(err));
}
static void test_asyncWaveTypeMpegvideo(HWND hwnd)
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/381
More information about the wine-devel
mailing list