[commit] r2721 - in trunk: Doc GME/Core

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Wed Dec 6 13:41:30 CST 2017


Author: ksmyth
Date: Wed Dec  6 13:41:30 2017
New Revision: 2721

Log:
CCoreCollectionHandlerTearOff: fix Release

Modified:
   trunk/Doc/README_in.txt
   trunk/GME/Core/Core.cpp

Modified: trunk/Doc/README_in.txt
==============================================================================
--- trunk/Doc/README_in.txt	Wed Dec  6 13:41:27 2017	(r2720)
+++ trunk/Doc/README_in.txt	Wed Dec  6 13:41:30 2017	(r2721)
@@ -29,6 +29,7 @@
 ----------------------------------
   - Binary compatibility with 11.12.2
   - Fix rare crash when IMgaAddOn is garbage collected (e.g. C# AddOns)
+  - Fix rare crash when calling Mga from a different COM apartment
 
 Release Notes of Release 17.11.14
 ----------------------------------

Modified: trunk/GME/Core/Core.cpp
==============================================================================
--- trunk/GME/Core/Core.cpp	Wed Dec  6 13:41:27 2017	(r2720)
+++ trunk/GME/Core/Core.cpp	Wed Dec  6 13:41:30 2017	(r2721)
@@ -50,20 +50,27 @@
 	CComPtr<CCoreCollectionHandler> m_pHandler;
 
     public:
-		CCoreCollectionHandlerTearOff() : refcount(1) {}
+		CCoreCollectionHandlerTearOff() :
+			refcount(1)
+		{
+			_pAtlModule->Lock();
+		}
 
 		virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, __RPC__deref_out void __RPC_FAR *__RPC_FAR *ppvObject);
 
         virtual ULONG STDMETHODCALLTYPE AddRef(void)
 		{
-			return InterlockedIncrement(&refcount);
+			return InterlockedIncrement(&this->refcount);
 		}
 
         virtual ULONG STDMETHODCALLTYPE Release(void)
 		{
-			long refcount = InterlockedDecrement(&refcount);
+			long refcount = InterlockedDecrement(&this->refcount);
 			if (refcount == 0)
+			{
 				delete this;
+				_pAtlModule->Unlock();
+			}
 			return refcount;
 		}
 


More information about the gme-commit mailing list