Commit 5ecc08e3 authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

browseui: Avoid race-conditions when progress dialog is released before thread terminates.

parent 73a68b06
......@@ -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, &params, 0, NULL);
WaitForSingleObject(params.hEvent, INFINITE);
CloseHandle(params.hEvent);
......
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