Author: tfaber
Date: Sat Jun 20 21:46:16 2015
New Revision: 68215
URL:
http://svn.reactos.org/svn/reactos?rev=68215&view=rev
Log:
[SHELL32]
- Fix assertion failure in 2nd stage by setting s_IsTerminated when an instance does not
yet exist.
- Rename CComCreatorSingleton to CComCreatorCentralInstance since it's not
/technically/ a singleton
Modified:
trunk/reactos/dll/win32/shell32/folders/CDesktopFolder.h
trunk/reactos/dll/win32/shell32/folders/CDrivesFolder.h
trunk/reactos/dll/win32/shell32/shell32.cpp
trunk/reactos/include/reactos/shellutils.h
Modified: trunk/reactos/dll/win32/shell32/folders/CDesktopFolder.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
==============================================================================
--- trunk/reactos/dll/win32/shell32/folders/CDesktopFolder.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/folders/CDesktopFolder.h [iso-8859-1] Sat Jun 20
21:46:16 2015
@@ -79,7 +79,7 @@
virtual HRESULT WINAPI CopyItems(IShellFolder *pSFFrom, UINT cidl, LPCITEMIDLIST
*apidl, BOOL bCopy);
DECLARE_REGISTRY_RESOURCEID(IDR_SHELLDESKTOP)
- DECLARE_SINGLETON_NOT_AGGREGATABLE(CDesktopFolder)
+ DECLARE_CENTRAL_INSTANCE_NOT_AGGREGATABLE(CDesktopFolder)
DECLARE_PROTECT_FINAL_CONSTRUCT()
Modified: trunk/reactos/dll/win32/shell32/folders/CDrivesFolder.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
==============================================================================
--- trunk/reactos/dll/win32/shell32/folders/CDrivesFolder.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/folders/CDrivesFolder.h [iso-8859-1] Sat Jun 20
21:46:16 2015
@@ -69,7 +69,7 @@
virtual HRESULT WINAPI GetCurFolder(LPITEMIDLIST * pidl);
DECLARE_REGISTRY_RESOURCEID(IDR_MYCOMPUTER)
- DECLARE_SINGLETON_NOT_AGGREGATABLE(CDrivesFolder)
+ DECLARE_CENTRAL_INSTANCE_NOT_AGGREGATABLE(CDrivesFolder)
DECLARE_PROTECT_FINAL_CONSTRUCT()
Modified: trunk/reactos/dll/win32/shell32/shell32.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shell32.…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shell32.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shell32.cpp [iso-8859-1] Sat Jun 20 21:46:16 2015
@@ -151,8 +151,8 @@
public:
void Term()
{
- CComCreatorSingleton< ATL::CComObject< CDrivesFolder > >::Term();
- CComCreatorSingleton< ATL::CComObject< CDesktopFolder > >::Term();
+ CComCreatorCentralInstance< ATL::CComObject< CDrivesFolder >
>::Term();
+ CComCreatorCentralInstance< ATL::CComObject< CDesktopFolder >
>::Term();
CComModule::Term();
}
};
Modified: trunk/reactos/include/reactos/shellutils.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/shellutils…
==============================================================================
--- trunk/reactos/include/reactos/shellutils.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/shellutils.h [iso-8859-1] Sat Jun 20 21:46:16 2015
@@ -43,7 +43,7 @@
#ifdef __cplusplus
template <typename T>
-class CComCreatorSingleton
+class CComCreatorCentralInstance
{
private:
static IUnknown *s_pInstance;
@@ -59,11 +59,18 @@
{
PVOID pObj;
HRESULT hr;
+ s_IsTerminated = true;
hr = ATL::CComCreator< T >::CreateInstance(NULL, IID_IUnknown,
&pObj);
if (FAILED(hr))
+ {
+ s_IsTerminated = false;
return hr;
+ }
if (InterlockedCompareExchangePointer((PVOID *)&s_pInstance, pObj,
NULL))
+ {
static_cast<IUnknown *>(pObj)->Release();
+ s_IsTerminated = false;
+ }
}
return s_pInstance->QueryInterface(riid, ppv);
}
@@ -87,14 +94,14 @@
};
template <typename T>
-IUnknown *CComCreatorSingleton<T>::s_pInstance = NULL;
+IUnknown *CComCreatorCentralInstance<T>::s_pInstance = NULL;
template <typename T>
-bool CComCreatorSingleton<T>::s_IsTerminated = false;
-
-#define DECLARE_SINGLETON_NOT_AGGREGATABLE(x) \
+bool CComCreatorCentralInstance<T>::s_IsTerminated = false;
+
+#define DECLARE_CENTRAL_INSTANCE_NOT_AGGREGATABLE(x) \
public: \
- typedef CComCreatorSingleton< ATL::CComObject<x> > _CreatorClass;
+ typedef CComCreatorCentralInstance< ATL::CComObject<x> > _CreatorClass;
#endif
#ifdef __cplusplus