Author: dreimer
Date: Sun Aug 24 13:25:12 2014
New Revision: 63932
URL:
http://svn.reactos.org/svn/reactos?rev=63932&view=rev
Log:
[SHELL32]
Marshall interface pointers during background delete by Huw Campbell
CORE-8460 #resolve #comment Committed by request of Victor. Have fun ^^
Modified:
trunk/reactos/dll/win32/shell32/defcontextmenu.cpp
trunk/reactos/dll/win32/shell32/folders/fs.cpp
trunk/reactos/dll/win32/shell32/folders/recyclebin.cpp
Modified: trunk/reactos/dll/win32/shell32/defcontextmenu.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/defconte…
==============================================================================
--- trunk/reactos/dll/win32/shell32/defcontextmenu.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/defcontextmenu.cpp [iso-8859-1] Sun Aug 24 13:25:12
2014
@@ -1144,18 +1144,17 @@
HRESULT CDefaultContextMenu::DoDelete(LPCMINVOKECOMMANDINFO lpcmi) {
TRACE("(%p) Deleting\n", this);
- LPDATAOBJECT pDataObj;
-
- if (SUCCEEDED(SHCreateDataObject(m_pidlFolder, m_cidl, m_apidl, NULL,
IID_PPV_ARG(IDataObject, &pDataObj))))
- {
- pDataObj->AddRef();
- SHCreateThread(DoDeleteThreadProc, pDataObj, NULL, NULL);
- pDataObj->Release();
+ CComPtr<IDataObject> pDataObject;
+
+ if (SUCCEEDED(SHCreateDataObject(m_pidlFolder, m_cidl, m_apidl, NULL,
IID_PPV_ARG(IDataObject, &pDataObject))))
+ {
+ IStream *s;
+ CoMarshalInterThreadInterfaceInStream(IID_IDataObject, pDataObject, &s);
+ SHCreateThread(DoDeleteThreadProc, s, NULL, NULL);
}
else
return E_FAIL;
return S_OK;
-
}
HRESULT
Modified: trunk/reactos/dll/win32/shell32/folders/fs.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
==============================================================================
--- trunk/reactos/dll/win32/shell32/folders/fs.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/folders/fs.cpp [iso-8859-1] Sun Aug 24 13:25:12 2014
@@ -1763,6 +1763,7 @@
data->This->Release();
//Release the parameter from the heap.
HeapFree(GetProcessHeap(), 0, data);
+ CoUninitialize();
return 0;
}
Modified: trunk/reactos/dll/win32/shell32/folders/recyclebin.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
==============================================================================
--- trunk/reactos/dll/win32/shell32/folders/recyclebin.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/folders/recyclebin.cpp [iso-8859-1] Sun Aug 24
13:25:12 2014
@@ -1459,8 +1459,9 @@
/* Handle cfShellIDList Drop objects here, otherwise send the approriate message to
other software */
if (SUCCEEDED(pDataObject->QueryGetData(&fmt))) {
- pDataObject->AddRef();
- SHCreateThread(DoDeleteThreadProc, pDataObject, NULL, NULL);
+ IStream *s;
+ CoMarshalInterThreadInterfaceInStream(IID_IDataObject, pDataObject, &s);
+ SHCreateThread(DoDeleteThreadProc, s, NULL, NULL);
}
else
{
@@ -1474,10 +1475,14 @@
DWORD WINAPI DoDeleteThreadProc(LPVOID lpParameter)
{
- IDataObject *pda = (IDataObject*) lpParameter;
- DoDeleteDataObject(pda);
- //Release the data object
- pda->Release();
+ CoInitialize(NULL);
+ CComPtr<IDataObject> pDataObject;
+ HRESULT hr = CoGetInterfaceAndReleaseStream
(static_cast<IStream*>(lpParameter), IID_PPV_ARG(IDataObject, &pDataObject));
+ if (SUCCEEDED(hr))
+ {
+ DoDeleteDataObject(pDataObject);
+ }
+ CoUninitialize();
return 0;
}