[commit] r1896 - in trunk: GME/Mga SDK/BON/Common

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Tue Apr 17 16:36:44 CDT 2012


Author: ksmyth
Date: Tue Apr 17 16:36:44 2012
New Revision: 1896

Log:
Fix leaks

Modified:
   trunk/GME/Mga/MgaAttribute.cpp
   trunk/GME/Mga/MgaProject.cpp
   trunk/SDK/BON/Common/Extensions.cpp
   trunk/SDK/BON/Common/Extensions.h

Modified: trunk/GME/Mga/MgaAttribute.cpp
==============================================================================
--- trunk/GME/Mga/MgaAttribute.cpp	Tue Apr 17 16:36:29 2012	(r1895)
+++ trunk/GME/Mga/MgaAttribute.cpp	Tue Apr 17 16:36:44 2012	(r1896)
@@ -773,7 +773,7 @@
 				CComPtr<CMgaRegNode> regnode;
 				CreateComObject(regnode);
 				regnode->Initialize(CComBSTR(pathsIt->c_str()), fco, mgaproject);
-				q->Append(regnode.Detach());
+				q->Append(regnode);
 			}
 			*pVal = q.Detach();
 		} COMCATCH(;)

Modified: trunk/GME/Mga/MgaProject.cpp
==============================================================================
--- trunk/GME/Mga/MgaProject.cpp	Tue Apr 17 16:36:29 2012	(r1895)
+++ trunk/GME/Mga/MgaProject.cpp	Tue Apr 17 16:36:44 2012	(r1896)
@@ -1726,6 +1726,7 @@
 	if (guidstat == DIRTY) {
 		GUID newGUID;
 		COMTHROW(CoCreateGuid(&newGUID));
+		pendingguid.Clear();
 		CopyTo(newGUID, pendingguid);
 		guidstat = PENDING;
 	}

Modified: trunk/SDK/BON/Common/Extensions.cpp
==============================================================================
--- trunk/SDK/BON/Common/Extensions.cpp	Tue Apr 17 16:36:29 2012	(r1895)
+++ trunk/SDK/BON/Common/Extensions.cpp	Tue Apr 17 16:36:44 2012	(r1896)
@@ -165,6 +165,13 @@
 	ExtensionManager::FunctionVector* ExtensionManager::_vecKindFunctions( NULL );
 	int ExtensionManager::_vecKindFunctions_refCnt( 0 );
 
+	struct ExtensionsCleanup {
+		~ExtensionsCleanup() {
+			delete ExtensionManager::_vecKindFunctions;
+			ExtensionManager::_vecKindFunctions = NULL;
+		}
+	} cleanup;
+
 	ExtensionManager::ExtensionManager( const std::vector<std::string>& vecKinds, CastFunction pFnCast, CreateFunction pFnCreate )
 	{
 		_vecKindFunctions_refCnt++;

Modified: trunk/SDK/BON/Common/Extensions.h
==============================================================================
--- trunk/SDK/BON/Common/Extensions.h	Tue Apr 17 16:36:29 2012	(r1895)
+++ trunk/SDK/BON/Common/Extensions.h	Tue Apr 17 16:36:44 2012	(r1896)
@@ -30,6 +30,7 @@
 
 namespace BON
 {
+	struct ExtensionsCleanup;
 	
 	enum ExtensionType {EXT_None = 0, EXT_MetaKind = 1, EXT_Kind = 2, EXT_Role = 3};
 	typedef std::pair<ExtensionType,int> ExtensionInfo;
@@ -158,6 +159,7 @@
 
 		// Friends
 			friend ObjectImpl;
+			friend ExtensionsCleanup;
 	};
 
 //###############################################################################################################################################


More information about the gme-commit mailing list