Changeset 63643 in vbox
- Timestamp:
- Aug 25, 2016 5:19:22 PM (8 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
-
include/VirtualBoxBase.h (modified) (1 diff)
-
include/VirtualBoxClientImpl.h (modified) (1 diff)
-
src-client/win/dllmain.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/VirtualBoxBase.h
r63331 r63643 67 67 #undef DECLARE_CLASSFACTORY_SINGLETON 68 68 #define DECLARE_CLASSFACTORY_SINGLETON(obj) DECLARE_CLASSFACTORY_EX(CMyComClassFactorySingleton<obj>) 69 70 /** 71 * @todo r=bird: This CMyComClassFactorySingleton stuff is probably obsoleted by 72 * microatl.h? Right? 73 */ 69 74 70 75 template <class T> -
trunk/src/VBox/Main/include/VirtualBoxClientImpl.h
r63639 r63643 47 47 HRESULT init(); 48 48 void uninit(); 49 50 #ifdef RT_OS_WINDOWS 51 /* HACK ALERT! Implemented in dllmain.cpp. */ 52 ULONG InternalRelease(); 53 #endif 49 54 50 55 private: -
trunk/src/VBox/Main/src-client/win/dllmain.cpp
r63641 r63643 117 117 } 118 118 119 120 #ifdef RT_OS_WINDOWS 121 /* 122 * HACK ALERT! Really ugly trick to make the VirtualBoxClient object go away 123 * when nobody uses it anymore. This is to prevent its uninit() 124 * method from accessing IVirtualBox and similar proxy stubs after 125 * COM has been officially shut down. 126 * 127 * It is simply TOO LATE to destroy the client object from DllMain/detach! 128 * 129 * This hack ASSUMES ObjectMap order. 130 * This hack is subject to a re-instantiation race. 131 */ 132 ULONG VirtualBoxClient::InternalRelease() 133 { 134 ULONG cRefs = VirtualBoxClientWrap::InternalRelease(); 135 # ifdef DEBUG_bird 136 char szMsg[64]; 137 RTStrPrintf(szMsg, sizeof(szMsg), "VirtualBoxClient: cRefs=%d\n", cRefs); 138 OutputDebugStringA(szMsg); 139 # endif 140 # if 1 /* enable ugly hack */ 141 if (cRefs == 1) 142 { 143 /* Make the factory to drop its reference. */ 144 if (ObjectMap[1].pCF) 145 { 146 InternalAddRef(); 147 148 CMyComClassFactorySingleton<VirtualBoxClient> *pFactory; 149 pFactory = dynamic_cast<CMyComClassFactorySingleton<VirtualBoxClient> *>(ObjectMap[1].pCF); 150 Assert(pFactory); 151 if (pFactory) 152 { 153 IUnknown *pUnknown = pFactory->m_spObj; 154 pFactory->m_spObj = NULL; 155 if (pUnknown) 156 pUnknown->Release(); 157 } 158 159 cRefs = VirtualBoxClientWrap::InternalRelease(); 160 } 161 } 162 # endif 163 return cRefs; 164 } 165 #endif 166 167
Note:
See TracChangeset
for help on using the changeset viewer.

