[commit] r2203 - trunk/GME/Mga

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Wed May 22 10:32:56 CDT 2013


Author: volgy
Date: Wed May 22 10:32:56 2013
New Revision: 2203

Log:
Bugfix: registry subtree removal 

Remove true subtrees. The old code removed all registry entries which had the same prefix as the node to be deleted.

Modified:
   trunk/GME/Mga/MgaAttribute.cpp

Modified: trunk/GME/Mga/MgaAttribute.cpp
==============================================================================
--- trunk/GME/Mga/MgaAttribute.cpp	Tue May 21 15:37:55 2013	(r2202)
+++ trunk/GME/Mga/MgaAttribute.cpp	Wed May 22 10:32:56 2013	(r2203)
@@ -1,4 +1,4 @@
-// MgaAttribute.cpp : Implementation of CMgaAttribute
+(// MgaAttribute.cpp : Implementation of CMgaAttribute
 #include "stdafx.h"
 #include "MgaAttribute.h"
 #include "MgaFCO.h"
@@ -834,11 +834,16 @@
 
 		for (auto it = map->begin(); it != map->end();)
 		{
-			if (wcsncmp(it->first ? it->first : L"", mypath, mypath.Length()) == 0)
+			std::wstring path = it->first ? it->first : L"";
+			if (wcsncmp(path.c_str(), mypath, mypath.Length()) == 0)
 			{
-				map->erase(it++);
-			} else
-				it++;
+				// PV: Remove only true subtree nodes (not just prefix testing)
+				if (path.length() > mypath.Length() && (mypath.Length() == 0 || path[mypath.Length()] == L'/')) {
+					map->erase(it++);
+					continue;	// modify collection while iterating
+				}
+			}
+			it++;
 		}
 		// TODO
 		markchg();


More information about the gme-commit mailing list