[commit] r2704 - trunk/GME/ObjectInspector

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Mon Oct 30 15:58:03 CDT 2017


Author: ksmyth
Date: Mon Oct 30 15:58:03 2017
New Revision: 2704

Log:
Fix ObjectInspector crash under x64

Modified:
   trunk/GME/ObjectInspector/Attribute.cpp
   trunk/GME/ObjectInspector/Attribute.h
   trunk/GME/ObjectInspector/InspectorList.cpp
   trunk/GME/ObjectInspector/InspectorList.h
   trunk/GME/ObjectInspector/ItemData.h
   trunk/GME/ObjectInspector/Preference.cpp

Modified: trunk/GME/ObjectInspector/Attribute.cpp
==============================================================================
--- trunk/GME/ObjectInspector/Attribute.cpp	Mon Oct 30 15:57:58 2017	(r2703)
+++ trunk/GME/ObjectInspector/Attribute.cpp	Mon Oct 30 15:58:03 2017	(r2704)
@@ -122,8 +122,7 @@
 			POSITION posCurrent=m_MetaAttributePtrList.AddTail(ADAPT_META_ATTRIBUTE(ccpMetaAttribute));
 			CListItem ListItem;
 
-			ASSERT(sizeof(POSITION)==sizeof(DWORD)); // Unusual conversion - let us check it
-			if(CreateListItem(ListItem,ccvtFirstValue,bIsDirty,bIsDefault,DWORD(posCurrent)))
+			if(CreateListItem(ListItem,ccvtFirstValue,bIsDirty,bIsDefault,posCurrent))
 			{
 				ListItemArray.Add(ListItem);
 			}
@@ -148,7 +147,7 @@
 		CListItem ListItem;
 
 		ListItem.strName = _T("Author");
-		ListItem.dwKeyValue = PROJECT_AUTHOR;
+		ListItem.dwKeyValue = (void*)(size_t)PROJECT_AUTHOR;
 		ListItem.bIsDefault = false;
 		ListItem.bIsDifferentValue = false;
 		ListItem.strToolTip = project_attribute_tooltips[PROJECT_AUTHOR];
@@ -167,7 +166,7 @@
 		CListItem ListItem;
 
 		ListItem.strName = _T("Version");
-		ListItem.dwKeyValue = PROJECT_VERSION;
+		ListItem.dwKeyValue = (void*)(size_t)PROJECT_VERSION;
 		ListItem.bIsDefault = false;
 		ListItem.bIsDifferentValue = false;
 		ListItem.strToolTip = project_attribute_tooltips[PROJECT_VERSION];
@@ -186,7 +185,7 @@
 		CListItem ListItem;
 
 		ListItem.strName = _T("Comment");
-		ListItem.dwKeyValue = PROJECT_COMMENT;
+		ListItem.dwKeyValue = (void*)(size_t)PROJECT_COMMENT;
 		ListItem.bIsDefault = false;
 		ListItem.bIsDifferentValue = false;
 		ListItem.strToolTip = project_attribute_tooltips[PROJECT_COMMENT];
@@ -263,7 +262,7 @@
 	*/
 }
 
-bool CAttribute::CreateListItem(CListItem &ListItem, const CComVariant &ccvtValue, bool bIsDirty, bool bIsDefault, DWORD dwKey)
+bool CAttribute::CreateListItem(CListItem &ListItem, const CComVariant &ccvtValue, bool bIsDirty, bool bIsDefault, POSITION dwKey)
 {
 	
 	CComPtr<IMgaMetaAttribute> ccpMetaAttribute=m_MetaAttributePtrList.GetAt(POSITION(dwKey));
@@ -537,7 +536,7 @@
 	strValue.Replace(_T("\r\n"), _T("\n"));
 	CComBSTR bstrValue(strValue);
 
-	switch (ListItem.dwKeyValue) {
+	switch ((size_t)ListItem.dwKeyValue) {
 	case PROJECT_AUTHOR:
 		COMTHROW(ccpProject->put_Author(bstrValue));
 		break;

Modified: trunk/GME/ObjectInspector/Attribute.h
==============================================================================
--- trunk/GME/ObjectInspector/Attribute.h	Mon Oct 30 15:57:58 2017	(r2703)
+++ trunk/GME/ObjectInspector/Attribute.h	Mon Oct 30 15:58:03 2017	(r2704)
@@ -26,7 +26,7 @@
 	void WriteItemToMga(CListItem ListItem, CComPtr<IMgaProject> ccpProject);
 	
 private:
-	bool CreateListItem(CListItem& ListItem, const CComVariant& ccvtValue, bool bIsDirty, bool bIsDefault, DWORD dwKey);
+	bool CreateListItem(CListItem& ListItem, const CComVariant& ccvtValue, bool bIsDirty, bool bIsDefault, POSITION dwKey);
 	bool isViewable( const CComPtr<IMgaFCO>& r, const CComPtr<IMgaMetaAttribute>& a) const;
 };
 

Modified: trunk/GME/ObjectInspector/InspectorList.cpp
==============================================================================
--- trunk/GME/ObjectInspector/InspectorList.cpp	Mon Oct 30 15:57:58 2017	(r2703)
+++ trunk/GME/ObjectInspector/InspectorList.cpp	Mon Oct 30 15:58:03 2017	(r2704)
@@ -1003,7 +1003,7 @@
 
 }
 
-bool CInspectorList::FindByKey(DWORD dwKey,CListItem& FoundListItem )
+bool CInspectorList::FindByKey(void* dwKey,CListItem& FoundListItem )
 {
 	for(int i=0;i<=m_ListItemArray.GetUpperBound();i++)
 	{
@@ -1034,7 +1034,7 @@
 }
 
 
-bool CInspectorList::FindByKey(DWORD dwKey,DWORD dwUserData, CListItem& FoundListItem )
+bool CInspectorList::FindByKey(void* dwKey,DWORD dwUserData, CListItem& FoundListItem )
 {
 	for(int i=0;i<=m_ListItemArray.GetUpperBound();i++)
 	{
@@ -1065,7 +1065,7 @@
 }
 
 
-void CInspectorList::DeleteByKey(DWORD dwKey, DWORD dwUserData)
+void CInspectorList::DeleteByKey(void* dwKey, DWORD dwUserData)
 {
 	for(int i=0;i<=m_ListItemArray.GetUpperBound();i++)
 	{
@@ -1101,7 +1101,7 @@
 }
 
 
-void CInspectorList::DeleteByKey(DWORD dwKey)
+void CInspectorList::DeleteByKey(void* dwKey)
 {
 
 	for(int i=0;i<=m_ListItemArray.GetUpperBound();i++)

Modified: trunk/GME/ObjectInspector/InspectorList.h
==============================================================================
--- trunk/GME/ObjectInspector/InspectorList.h	Mon Oct 30 15:57:58 2017	(r2703)
+++ trunk/GME/ObjectInspector/InspectorList.h	Mon Oct 30 15:58:03 2017	(r2704)
@@ -67,10 +67,10 @@
 	void RefreshState();
 	void NotifyParent(UINT nSelItem);
 
-	void DeleteByKey(DWORD dwKey);
-	void DeleteByKey(DWORD dwKey, DWORD dwUserData);
-	bool FindByKey(DWORD,CListItem&);
-	bool FindByKey(DWORD, DWORD, CListItem&);
+	void DeleteByKey(void* dwKey);
+	void DeleteByKey(void* dwKey, DWORD dwUserData);
+	bool FindByKey(void*, CListItem&);
+	bool FindByKey(void*, DWORD, CListItem&);
 
 	bool OnRightSideClick(CPoint point);
 	bool OnPlusMinusClick(CPoint point);

Modified: trunk/GME/ObjectInspector/ItemData.h
==============================================================================
--- trunk/GME/ObjectInspector/ItemData.h	Mon Oct 30 15:57:58 2017	(r2703)
+++ trunk/GME/ObjectInspector/ItemData.h	Mon Oct 30 15:58:03 2017	(r2704)
@@ -121,7 +121,7 @@
 	bool bIsDifferentValue;
 
 	// User data
-	DWORD dwKeyValue;
+	void* dwKeyValue;
 	DWORD dwUserData;
 
 	CListItem();

Modified: trunk/GME/ObjectInspector/Preference.cpp
==============================================================================
--- trunk/GME/ObjectInspector/Preference.cpp	Mon Oct 30 15:57:58 2017	(r2703)
+++ trunk/GME/ObjectInspector/Preference.cpp	Mon Oct 30 15:58:03 2017	(r2704)
@@ -739,7 +739,7 @@
 	ListItem.strToolTip=(*pTableRow)[4];
 	ListItem.bIsDefault=bIsDefault;
 	ListItem.bIsDifferentValue=!bSameValueForAll;
-	ListItem.dwKeyValue=(DWORD)nKey;
+	ListItem.dwKeyValue = nKey;
 	ListItem.dwUserData=0;
 
 	CString strPrefName=(*pTableRow)[1];


More information about the gme-commit mailing list