[commit] r2388 - trunk/GME/GMEActiveBrowser

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Wed Oct 16 12:35:29 CDT 2013


Author: ksmyth
Date: Wed Oct 16 12:35:28 2013
New Revision: 2388

Log:
HighlightItem: better error handling

Modified:
   trunk/GME/GMEActiveBrowser/ActiveBrowserPropertyPage.cpp
   trunk/GME/GMEActiveBrowser/GMEActiveBrowserCtl.cpp

Modified: trunk/GME/GMEActiveBrowser/ActiveBrowserPropertyPage.cpp
==============================================================================
--- trunk/GME/GMEActiveBrowser/ActiveBrowserPropertyPage.cpp	Wed Oct 16 09:59:51 2013	(r2387)
+++ trunk/GME/GMEActiveBrowser/ActiveBrowserPropertyPage.cpp	Wed Oct 16 12:35:28 2013	(r2388)
@@ -4252,12 +4252,11 @@
 	CGMEActiveBrowserApp* pApp=(CGMEActiveBrowserApp*)AfxGetApp();
 	CMgaContext* pMgaContext=&pApp->m_CurrentProject.m_MgaContext;
 	CComPtr<IMgaObject> terrObj;
-	pMgaContext->m_ccpTerritory->OpenObj(pObj, &terrObj);
+	pMgaContext->m_ccpTerritory->__OpenObj(pObj, &terrObj);
 	CComPtr<IUnknown> pUnk;
 	terrObj.QueryInterface(&pUnk.p);
 
-	CComBSTR id;
-	pObj->get_ID(&id);
+	CComBSTR id = static_cast<BSTR>(pObj->ID);
 
 	auto& highlightedObjects = m_TreeAggregate.m_highlightedObjects;
 	if (highlight)

Modified: trunk/GME/GMEActiveBrowser/GMEActiveBrowserCtl.cpp
==============================================================================
--- trunk/GME/GMEActiveBrowser/GMEActiveBrowserCtl.cpp	Wed Oct 16 09:59:51 2013	(r2387)
+++ trunk/GME/GMEActiveBrowser/GMEActiveBrowserCtl.cpp	Wed Oct 16 12:35:28 2013	(r2388)
@@ -704,25 +704,32 @@
 void CGMEActiveBrowserCtrl::HighlightItem(IUnknown* item, int highlight)
 {
 	if (item == nullptr)
-		return;
+		AfxThrowOleDispatchException(201, _T("First parameter must not be null."));
 	CComPtr<IMgaObject> object;
 	item->QueryInterface(&object.p);
 	if (!object)
-		return;
+		AfxThrowOleDispatchException(202, L"First parameter is of wrong type. It must be IMgaObject.");
 
 	CGMEActiveBrowserApp* pApp = (CGMEActiveBrowserApp*)AfxGetApp();
-	if (pApp)
+	try
 	{
-		pApp->m_CurrentProject.m_MgaContext.SetEventTransactionMode(true);
-		try
-		{
-			m_pPropFrame->m_pModelessPropSheet->m_PageAggregate.HighlightItem(object, highlight);
-		}
-		catch (...)
+		if (pApp)
 		{
+			pApp->m_CurrentProject.m_MgaContext.SetEventTransactionMode(true);
+			try
+			{
+				m_pPropFrame->m_pModelessPropSheet->m_PageAggregate.HighlightItem(object, highlight);
+			}
+			catch (...)
+			{
+				pApp->m_CurrentProject.m_MgaContext.SetEventTransactionMode(false);
+				throw;
+			}
 			pApp->m_CurrentProject.m_MgaContext.SetEventTransactionMode(false);
-			throw;
 		}
-		pApp->m_CurrentProject.m_MgaContext.SetEventTransactionMode(false);
+	}
+	catch (const _com_error& e)
+	{
+		AfxThrowOleDispatchException(203, e.Description());
 	}
 }


More information about the gme-commit mailing list