You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-09-12 18:50:20 -07:00
Added patches to fix race-condition when closing browseui IProcessDialog.
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
From d8497e4ebc1fb5a3b703e4dd4474c65bbb25796d Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sun, 1 Mar 2015 03:46:06 +0100
|
||||
Subject: browseui: Always use interlocked functions when accessing variable
|
||||
BROWSEUI_refCount.
|
||||
|
||||
---
|
||||
dlls/browseui/browseui_main.c | 4 ++--
|
||||
dlls/browseui/compcatcachedaemon.c | 4 ++--
|
||||
dlls/browseui/progressdlg.c | 4 ++--
|
||||
3 files changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/dlls/browseui/browseui_main.c b/dlls/browseui/browseui_main.c
|
||||
index 78ce326..f509ee5 100644
|
||||
--- a/dlls/browseui/browseui_main.c
|
||||
+++ b/dlls/browseui/browseui_main.c
|
||||
@@ -74,7 +74,7 @@ static void ClassFactory_Destructor(ClassFactory *This)
|
||||
{
|
||||
TRACE("Destroying class factory %p\n", This);
|
||||
heap_free(This);
|
||||
- BROWSEUI_refCount--;
|
||||
+ InterlockedDecrement(&BROWSEUI_refCount);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, LPVOID *ppvOut)
|
||||
@@ -154,7 +154,7 @@ static HRESULT ClassFactory_Constructor(LPFNCONSTRUCTOR ctor, LPVOID *ppvOut)
|
||||
This->ctor = ctor;
|
||||
*ppvOut = This;
|
||||
TRACE("Created class factory %p\n", This);
|
||||
- BROWSEUI_refCount++;
|
||||
+ InterlockedIncrement(&BROWSEUI_refCount);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
diff --git a/dlls/browseui/compcatcachedaemon.c b/dlls/browseui/compcatcachedaemon.c
|
||||
index 0acb4ec..a5addd2 100644
|
||||
--- a/dlls/browseui/compcatcachedaemon.c
|
||||
+++ b/dlls/browseui/compcatcachedaemon.c
|
||||
@@ -60,7 +60,7 @@ static void CompCatCacheDaemon_Destructor(CompCatCacheDaemon *This)
|
||||
This->cs.DebugInfo->Spare[0] = 0;
|
||||
DeleteCriticalSection(&This->cs);
|
||||
heap_free(This);
|
||||
- BROWSEUI_refCount--;
|
||||
+ InterlockedDecrement(&BROWSEUI_refCount);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI CompCatCacheDaemon_QueryInterface(IRunnableTask *iface, REFIID iid, LPVOID *ppvOut)
|
||||
@@ -159,6 +159,6 @@ HRESULT CompCatCacheDaemon_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
|
||||
|
||||
TRACE("returning %p\n", This);
|
||||
*ppOut = (IUnknown *)This;
|
||||
- BROWSEUI_refCount++;
|
||||
+ InterlockedIncrement(&BROWSEUI_refCount);
|
||||
return S_OK;
|
||||
}
|
||||
diff --git a/dlls/browseui/progressdlg.c b/dlls/browseui/progressdlg.c
|
||||
index 598197b..e61a4cc 100644
|
||||
--- a/dlls/browseui/progressdlg.c
|
||||
+++ b/dlls/browseui/progressdlg.c
|
||||
@@ -268,7 +268,7 @@ static void ProgressDialog_Destructor(ProgressDialog *This)
|
||||
This->cs.DebugInfo->Spare[0] = 0;
|
||||
DeleteCriticalSection(&This->cs);
|
||||
heap_free(This);
|
||||
- BROWSEUI_refCount--;
|
||||
+ InterlockedDecrement(&BROWSEUI_refCount);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ProgressDialog_QueryInterface(IProgressDialog *iface, REFIID iid, LPVOID *ppvOut)
|
||||
@@ -574,6 +574,6 @@ HRESULT ProgressDialog_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
|
||||
|
||||
TRACE("returning %p\n", This);
|
||||
*ppOut = (IUnknown *)This;
|
||||
- BROWSEUI_refCount++;
|
||||
+ InterlockedIncrement(&BROWSEUI_refCount);
|
||||
return S_OK;
|
||||
}
|
||||
--
|
||||
2.3.0
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
From da4415d947b792fc5e0de978cf22e68d2b6b8601 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sun, 1 Mar 2015 03:52:06 +0100
|
||||
Subject: 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);
|
||||
--
|
||||
2.3.0
|
||||
|
||||
Reference in New Issue
Block a user