[commit] r2591 - in trunk: Doc GME/Mga Tests/GPyUnit

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Wed Apr 8 11:10:39 CDT 2015


Author: ksmyth
Date: Wed Apr  8 11:10:39 2015
New Revision: 2591

Log:
Fix bug where an instance of a library object would have IsLibObject == true after DetachFromArcheType() was called on it

Modified:
   trunk/Doc/README_in.txt
   trunk/GME/Mga/MgaComplexOps.cpp
   trunk/GME/Mga/MgaGeneric.h
   trunk/Tests/GPyUnit/test_instances.py

Modified: trunk/Doc/README_in.txt
==============================================================================
--- trunk/Doc/README_in.txt	Wed Mar  4 09:31:28 2015	(r2590)
+++ trunk/Doc/README_in.txt	Wed Apr  8 11:10:39 2015	(r2591)
@@ -25,6 +25,11 @@
 1. Release Notes
 ************************************************
 
+Release Notes
+----------------------------------
+  - Binary compatibility with 11.12.2
+  - Fix bug where an instance of a library object would have IsLibObject == true after DetachFromArcheType() was called on it
+
 Release Notes of Release 14.12.4
 ----------------------------------
   - Binary compatibility with 11.12.2

Modified: trunk/GME/Mga/MgaComplexOps.cpp
==============================================================================
--- trunk/GME/Mga/MgaComplexOps.cpp	Wed Mar  4 09:31:28 2015	(r2590)
+++ trunk/GME/Mga/MgaComplexOps.cpp	Wed Apr  8 11:10:39 2015	(r2591)
@@ -1683,8 +1683,10 @@
 					}
 					case ATTRID_PERMISSIONS:
 					{
-						if( nobj[ai] & INSTANCE_FLAG) //if INSTANCE_FLAG present
-							nobj[ai] = (orig[ai]) & ~INSTANCE_FLAG;//then INSTANCE_FLAG removed;
+						nobj[ai] = nobj[ai] & ~INSTANCE_FLAG; // remove INSTANCE_FLAG
+						// do not modify LIBROOT_FLAG LIBRARY_FLAG READONLY_FLAG EXEMPT_FLAG as these are not inherited
+						//   (though LIBROOT_FLAG LIBRARY_FLAG READONLY_FLAG should be false here or CheckWrite would have failed)
+
 						break;
 					}
 					case ATTRID_RELID:

Modified: trunk/GME/Mga/MgaGeneric.h
==============================================================================
--- trunk/GME/Mga/MgaGeneric.h	Wed Mar  4 09:31:28 2015	(r2590)
+++ trunk/GME/Mga/MgaGeneric.h	Wed Apr  8 11:10:39 2015	(r2591)
@@ -43,7 +43,7 @@
 #define ATTRID_SETMEMBER				612 
 #define ATTRID_CONNSEG					613
 #define ATTRID_CONNROLE					614
-#define ATTRID_PERMISSIONS				415
+#define ATTRID_PERMISSIONS				415 // flags: INSTANCE_FLAG LIBROOT_FLAG LIBRARY_FLAG EXEMPT_FLAG READONLY_FLAG
 #define ATTRID_SEGORDNUM				416
 #define ATTRID_MASTEROBJ				517
 #define ATTRID_REFASPECT				418

Modified: trunk/Tests/GPyUnit/test_instances.py
==============================================================================
--- trunk/Tests/GPyUnit/test_instances.py	Wed Mar  4 09:31:28 2015	(r2590)
+++ trunk/Tests/GPyUnit/test_instances.py	Wed Apr  8 11:10:39 2015	(r2591)
@@ -143,3 +143,50 @@
         self.project.CommitTransaction()
 
 #GPyUnit.util.MUGenerator(globals(), TestInstances)
+
+class TestInstancesLib(unittest.TestCase):
+    project = None
+    def __init__(self, name, **kwds):
+        super(TestInstancesLib, self).__init__(name, **kwds)
+
+    def tearDown(self):
+        if self.project:
+            self.project.Close(True)
+
+    @property
+    def connstr(self):
+        return "MGA=" + _adjacent_file("tmp.mga")
+    
+    @dec_disable_early_binding
+    def test_DetachFromArcheType_InstanceIsLibObject(self):
+        lib_path = 'MGA=' + _adjacent_file("instance_lib.mga")
+        def createLibProject():
+            lib_project = DispatchEx("Mga.MgaProject")
+            lib_project.Create(lib_path, "MetaGME")
+            paradigmSheet = lib_project.RootMeta.RootFolder.DefinedFCOByName('ParadigmSheet', True)
+            lib_project.BeginTransactionInNewTerr()
+            base = lib_project.RootFolder.CreateRootObject(paradigmSheet)
+            base.Name = "PS"
+            atom = base.CreateChildObject(paradigmSheet.RoleByName('Atom'))
+            atom.Name = "Atom"
+            lib_project.CommitTransaction()
+            lib_project.Save()
+            lib_project.Close()
+        createLibProject()
+        
+        self.project = GPyUnit.util.parse_xme(self.connstr)
+        self.project.BeginTransactionInNewTerr()
+        lib_obj = self.project.RootFolder.AttachLibrary(lib_path)
+        self.project.CommitTransaction()
+        self.project.BeginTransactionInNewTerr()
+        
+        ps_instance = self.project.RootFolder.DeriveRootObject(lib_obj.GetObjectByPathDisp("@PS"), True)
+        atom = ps_instance.GetObjectByPathDisp("@Atom")
+        self.assertFalse(ps_instance.IsLibObject)
+        self.assertFalse(atom.IsLibObject)
+        ps_instance.DetachFromArcheType()
+        self.assertFalse(atom.IsLibObject)
+        self.assertFalse(ps_instance.IsLibObject)
+        
+        self.project.CommitTransaction()
+        self.project.Save()


More information about the gme-commit mailing list