[commit] r2081 - in trunk/GME: Common ConstraintManager Gme

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Thu Oct 18 10:30:09 CDT 2012


Author: ksmyth
Date: Thu Oct 18 10:30:09 2012
New Revision: 2081

Log:
Fix (eventual) crash when reversing connection direction results in a constraint violation

Modified:
   trunk/GME/Common/CommonMfc.h
   trunk/GME/ConstraintManager/OCLGMECMFacade.cpp
   trunk/GME/Gme/GMEView.cpp

Modified: trunk/GME/Common/CommonMfc.h
==============================================================================
--- trunk/GME/Common/CommonMfc.h	Thu Oct  4 10:12:19 2012	(r2080)
+++ trunk/GME/Common/CommonMfc.h	Thu Oct 18 10:30:09 2012	(r2081)
@@ -272,7 +272,8 @@
 	catch(hresult_exception &e) \
 	{ \
 		{ CLEANUP; } \
-		DisplayError(MSG, e.hr); \
+		if (e.hr != E_MGA_CONSTRAINT_VIOLATION) \
+			DisplayError(MSG, e.hr); \
 	} \
 	catch(_com_error &e) { \
 		{ CLEANUP; } \
@@ -281,7 +282,8 @@
 			error = e.Description(); \
 		else \
 			GetErrorInfo(e.Error(), error.GetAddress()); \
-		AfxMessageBox(_bstr_t(MSG) + ": " + error, MB_OK | MB_ICONSTOP); \
+		if (e.Error() != E_MGA_CONSTRAINT_VIOLATION) \
+			AfxMessageBox(_bstr_t(MSG) + ": " + error, MB_OK | MB_ICONSTOP); \
 	}
 
 #endif//MGA_COMMONMFC_H

Modified: trunk/GME/ConstraintManager/OCLGMECMFacade.cpp
==============================================================================
--- trunk/GME/ConstraintManager/OCLGMECMFacade.cpp	Thu Oct  4 10:12:19 2012	(r2080)
+++ trunk/GME/ConstraintManager/OCLGMECMFacade.cpp	Thu Oct 18 10:30:09 2012	(r2081)
@@ -752,7 +752,11 @@
 			m_bViolationDlgExpanded = dlgErrors.IsExpanded();
 			if (punk)
 				dlgErrors.GetGotoPunk(punk);
-			return ( iResult != IDOK ) ? E_MGA_CONSTRAINT_VIOLATION : S_OK;
+			if ( iResult != IDOK ) {
+				SetErrorInfo(L"Constraint violation");
+				return E_MGA_CONSTRAINT_VIOLATION;
+			} else
+				S_OK;
 		}
 		else
 			if ( bShowProgress && closeNotRequested )

Modified: trunk/GME/Gme/GMEView.cpp
==============================================================================
--- trunk/GME/Gme/GMEView.cpp	Thu Oct  4 10:12:19 2012	(r2080)
+++ trunk/GME/Gme/GMEView.cpp	Thu Oct 18 10:30:09 2012	(r2081)
@@ -7829,8 +7829,8 @@
 				}
 				connection->RegistryValue[autoroutePrefKey] = autoroutePref;
 			}
-			CommitTransaction();
-		} MSGCATCH(L"Could not delete connection", ;)
+			__CommitTransaction();
+		} MSGCATCH(L"Could not reverse connection direction", --inTransaction; theApp.mgaProject->AbortTransaction();)
 		contextSelection = 0;
 		contextPort = 0;
 	}


More information about the gme-commit mailing list