[commit] r2446 - trunk/GME/Mga

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Mon Feb 24 13:13:21 CST 2014


Author: ksmyth
Date: Mon Feb 24 13:13:21 2014
New Revision: 2446

Log:
AddOns may modify objects in MgaProject::CommitNotify. Track these changes and notify territory handlers. Fixes bug where FCO is modified in CommitNotify, the change is thrown out, and the next time the FCO is modified, nobody is notified because temporalmask!=0 (META-2922)

Modified:
   trunk/GME/Mga/MgaComplexOps.cpp
   trunk/GME/Mga/MgaProject.cpp

Modified: trunk/GME/Mga/MgaComplexOps.cpp
==============================================================================
--- trunk/GME/Mga/MgaComplexOps.cpp	Mon Feb 24 13:13:09 2014	(r2445)
+++ trunk/GME/Mga/MgaComplexOps.cpp	Mon Feb 24 13:13:21 2014	(r2446)
@@ -180,7 +180,9 @@
 		CMgaProject::addoncoll::iterator ai, abeg = mgaproject->alladdons.begin(), aend = mgaproject->alladdons.end();
 		if(abeg != aend) 
 		{
-			COMTHROW(mgaproject->pushterr(*mgaproject->reserveterr));
+			bool push_terr = mgaproject->activeterr != mgaproject->reserveterr; // this method can be reentrant
+			if (push_terr)
+				COMTHROW(mgaproject->pushterr(*mgaproject->reserveterr));
 			for(ai = abeg; ai != aend; ) 
 			{
 				CComPtr<CMgaAddOn> t = *ai++;	
@@ -195,7 +197,8 @@
 				    t->notified = true;
 				}
 			}
-			COMTHROW(mgaproject->popterr());
+			if (push_terr)
+				COMTHROW(mgaproject->popterr());
 		}
 	} COMCATCH(;)
 }

Modified: trunk/GME/Mga/MgaProject.cpp
==============================================================================
--- trunk/GME/Mga/MgaProject.cpp	Mon Feb 24 13:13:09 2014	(r2445)
+++ trunk/GME/Mga/MgaProject.cpp	Mon Feb 24 13:13:21 2014	(r2446)
@@ -1420,8 +1420,19 @@
 //			self[ATTRID_MDATE] = Now();
 		}
 		HRESULT hr = CommitNotify();
-		while (temporalobjs.size()) // CommitNotify may make changes. Don't notify for them.
-			temporalobjs.pop();
+		if (!temporalobjs.empty()) // CommitNotify may make changes. Notify only territories
+		{
+			while (!temporalobjs.empty()) {
+				temporalobjs.front()->objrecordchange();
+				temporalobjs.pop();
+			}
+			while (!changedobjs.empty()) {
+				FCOPtr f = changedobjs.front();
+				changedobjs.pop();
+			}
+			CommitNotify();
+			ASSERT(temporalobjs.empty());
+		}
 		if (FAILED(hr))
 			return hr;
 		COMTHROW(dataproject->PopTerritory());


More information about the gme-commit mailing list