[commit] r2569 - trunk/GME/Gme

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Mon Nov 17 12:49:00 CST 2014


Author: ksmyth
Date: Mon Nov 17 12:49:00 2014
New Revision: 2569

Log:
Fix recent project list when using two instances of GME (barring races)

Modified:
   trunk/GME/Gme/GMEApp.cpp
   trunk/GME/Gme/RecentConnStrList.cpp
   trunk/GME/Gme/RecentConnStrList.h

Modified: trunk/GME/Gme/GMEApp.cpp
==============================================================================
--- trunk/GME/Gme/GMEApp.cpp	Mon Nov 17 12:48:50 2014	(r2568)
+++ trunk/GME/Gme/GMEApp.cpp	Mon Nov 17 12:49:00 2014	(r2569)
@@ -496,8 +496,7 @@
 										   (hr == S_OK)? _T("has") : _T("might have"),
 										   embackupname);
 			AfxMessageBox(emergencySaveMsg);
-			m_RecentProjectList.Add(embackupname);
-			m_RecentProjectList.WriteList();
+			m_RecentProjectList.AddAndWriteList(embackupname);
 		}
 	}
 }
@@ -1273,8 +1272,7 @@
 		ChangedProjectConnStrings();
 // record connection name
 		currentConnection = conn;
-		m_RecentProjectList.Add(conn);
-		m_RecentProjectList.WriteList();
+		m_RecentProjectList.AddAndWriteList(conn);
 		if (!CGMEDoc::theInstance) {
 			CWinAppEx::OnFileNew();
 		}
@@ -1713,8 +1711,7 @@
 	if ((!conn.IsEmpty()) && (currentConnection != conn)) {
 		ChangedProjectConnStrings();
 		currentConnection = conn;
-		m_RecentProjectList.Add(conn);
-		m_RecentProjectList.WriteList();
+		m_RecentProjectList.AddAndWriteList(conn);
 	}
 }	
 

Modified: trunk/GME/Gme/RecentConnStrList.cpp
==============================================================================
--- trunk/GME/Gme/RecentConnStrList.cpp	Mon Nov 17 12:48:50 2014	(r2568)
+++ trunk/GME/Gme/RecentConnStrList.cpp	Mon Nov 17 12:49:00 2014	(r2569)
@@ -133,6 +133,13 @@
 	pCmdUI->m_bEnableChanged = TRUE;    // all the added items are enabled
 }
 
+void CRecentConnStrList::AddAndWriteList(LPCTSTR lpszConnName)
+{
+	ReadList();
+	Add(lpszConnName);
+	WriteList();
+}
+
 void CRecentConnStrList::WriteList()
 {
 	ASSERT(m_arrNames.size() > 0);

Modified: trunk/GME/Gme/RecentConnStrList.h
==============================================================================
--- trunk/GME/Gme/RecentConnStrList.h	Mon Nov 17 12:48:50 2014	(r2568)
+++ trunk/GME/Gme/RecentConnStrList.h	Mon Nov 17 12:49:00 2014	(r2569)
@@ -26,16 +26,19 @@
 	{ return m_arrNames[nIndex]; }
 
 // Operations
-	void Remove(int nIndex);
-	void Add(LPCTSTR lpszConnName);
 	BOOL GetDisplayName(CString& strName, int nIndex) const;
 	void UpdateMenu(CCmdUI* pCmdUI,bool enable);
 	void ReadList();    // reads from registry or ini file
-	void WriteList();   // writes to registry or ini file
+	void AddAndWriteList(LPCTSTR lpszConnName);
 
-// Implementation
+	// Implementation
 	virtual ~CRecentConnStrList();
 
+private:
+	void Add(LPCTSTR lpszConnName);
+	void Remove(int nIndex);
+	void WriteList();   // writes to registry or ini file
+
 	std::vector<CString> m_arrNames;
 	CString m_strSectionName;   // for saving
 	CString m_strEntryFormat;


More information about the gme-commit mailing list