Sebastian Lackner : browseui: Avoid race-conditions when progress dialog is released before thread terminates.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Mar 26 11:13:56 CDT 2015
Module: wine
Branch: master
Commit: 5ecc08e349932bc933daa1573e635375b5512e71
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5ecc08e349932bc933daa1573e635375b5512e71
Author: Sebastian Lackner <sebastian at fds-team.de>
Date: Sun Mar 1 03:52:06 2015 +0100
browseui: Avoid race-conditions when progress dialog is released before thread terminates.
---
dlls/browseui/progressdlg.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/dlls/browseui/progressdlg.c b/dlls/browseui/progressdlg.c
index e61a4cc..7d07ee9 100644
--- a/dlls/browseui/progressdlg.c
+++ b/dlls/browseui/progressdlg.c
@@ -235,6 +235,7 @@ static DWORD WINAPI dialog_thread(LPVOID lpParameter)
/* Note: until we set the hEvent in WM_INITDIALOG, the ProgressDialog object
* is protected by the critical section held by StartProgress */
struct create_params *params = lpParameter;
+ ProgressDialog *This = params->This;
HWND hwnd;
MSG msg;
@@ -252,6 +253,7 @@ static DWORD WINAPI dialog_thread(LPVOID lpParameter)
}
}
+ IProgressDialog_Release(&This->IProgressDialog_iface);
return 0;
}
@@ -341,10 +343,14 @@ static HRESULT WINAPI ProgressDialog_StartProgressDialog(IProgressDialog *iface,
return S_OK; /* as on XP */
}
This->dwFlags = dwFlags;
+
params.This = This;
params.hwndParent = hwndParent;
params.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
+ /* thread holds one reference to ensure clean shutdown */
+ IProgressDialog_AddRef(&This->IProgressDialog_iface);
+
hThread = CreateThread(NULL, 0, dialog_thread, ¶ms, 0, NULL);
WaitForSingleObject(params.hEvent, INFINITE);
CloseHandle(params.hEvent);
More information about the wine-cvs
mailing list