bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFA] GDL2 EOModel _entities cache


From: David Ayers
Subject: [RFA] GDL2 EOModel _entities cache
Date: Tue, 04 Feb 2003 19:32:58 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3a) Gecko/20021212

Hello,

this patch ensures that the _entites cache is always triggered before it's accessed.

I'll submit this upon approval or in a couple of days save objections.

Cheers,
Dave

2003-02-03  David Ayers  <d.ayers@inode.at>

   * EOAccess/EOModel.m
   ([EOModel -encodeTableOfContentsIntoPropertyList:]),
   ([EOModel -initWithPropertyList:owner:]),
   ([EOModel -encodeIntoPropertyList:]),
   ([EOModel -encodeIntoPropertyList:]), ([EOModel -addEntity:]),
   ([EOModel -removeEntity:]), ([EOModel -beautifyNames]),
   ([EOModel -setCreateMutableObjects:]):
   Do not access _entities until cache is triggered.

Index: dev-libs/gdl2/ChangeLog
===================================================================
RCS file: /cvsroot/gnustep/gnustep/dev-libs/gdl2/ChangeLog,v
retrieving revision 1.32
diff -u -r1.32 ChangeLog
--- dev-libs/gdl2/ChangeLog     2 Feb 2003 08:07:08 -0000       1.32
+++ dev-libs/gdl2/ChangeLog     4 Feb 2003 18:24:20 -0000
@@ -1,3 +1,14 @@
+2003-02-03  David Ayers  <d.ayers@inode.at>
+
+       * EOAccess/EOModel.m
+       ([EOModel -encodeTableOfContentsIntoPropertyList:]),
+       ([EOModel -initWithPropertyList:owner:]),
+       ([EOModel -encodeIntoPropertyList:]),
+       ([EOModel -encodeIntoPropertyList:]), ([EOModel -addEntity:]),
+       ([EOModel -removeEntity:]), ([EOModel -beautifyNames]),
+       ([EOModel -setCreateMutableObjects:]):
+       Do not access _entities until cache is triggerd.
+
 2003-02-02  Mirko Viviani  <mirko.viviani@rccr.cremona.it>
 
        * EOControl/EOGenericRecord.m ([EOGenericRecord +initialize]): import
@@ -64,7 +75,7 @@
        * EOControl/EODebug.m:
                o include NSDebug.h
        
-2003-01-21  David Ayers <d.ayers@inode.at>
+2003-01-21  David Ayers  <d.ayers@inode.at>
 
        * EOControl/EOQualifier.m ([EOQualifier +allQualifierOperators]): 
        ([EOQualifier +relationalQualifierOperators]): 
@@ -76,7 +87,7 @@
        * EOControl/EOObserver.m: Added implementation for EODelayedObserver
        and EODelayedObserverQueue.
 
-2003-01-16  David Ayers <d.ayers@inode.at>
+2003-01-16  David Ayers  <d.ayers@inode.at>
 
        * EOAdaptors/Postgres95/Postgres95Adaptor.m:
        Added import of NSDebug.h/EODebug.h
Index: dev-libs/gdl2/EOAccess/EOModel.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/dev-libs/gdl2/EOAccess/EOModel.m,v
retrieving revision 1.8
diff -u -r1.8 EOModel.m
--- dev-libs/gdl2/EOAccess/EOModel.m    31 Dec 2002 16:24:41 -0000      1.8
+++ dev-libs/gdl2/EOAccess/EOModel.m    4 Feb 2003 18:24:20 -0000
@@ -704,7 +704,8 @@
   if (_docComment)
     [propertyList setObject: _docComment forKey: @"docComment"];
 
-  count = [_entities count];
+  /* Do not access _entities until cache is triggered */
+  count = [[self entities] count];
   entitiesArray = [NSMutableArray arrayWithCapacity: count];
   [propertyList setObject: entitiesArray forKey: @"entities"];
 
@@ -797,7 +798,8 @@
               [self addEntity: entity];
             }
 
-          enumerator = [_entities objectEnumerator];
+          /* Do not access _entities until cache is triggered */
+          enumerator = [[self entities] objectEnumerator];
           while ((entity = [enumerator nextObject]))
             {
               NS_DURING
@@ -892,7 +894,8 @@
   if (_docComment)
     [propertyList setObject: _docComment forKey: @"docComment"];
 
-  count = [_entities count];
+  /* Do not access _entities until cache is triggered */
+  count = [[self entities] count];
 
   if (count > 0)
     {
@@ -1280,11 +1283,12 @@
                  self,
                  entityName];
 
+  /* Do not access _entities until cache is triggered */
   if ([self createsMutableObjects])
-    [(GCMutableArray *)_entities addObject: entity];
+    [(GCMutableArray *)[self entities] addObject: entity];
   else
     {
-      id       e = [[GCMutableArray alloc] initWithArray: _entities];
+      id       e = [[GCMutableArray alloc] initWithArray: [self entities]];
 
       [e addObject: entity];
       ASSIGNCOPY(_entities, e);
@@ -1319,11 +1323,12 @@
   NSAssert1(className, @"No className in %@", entity);
   NSMapRemove(_entitiesByClass, className);
 
+  /* Do not access _entities until cache is triggered */
   if ([self createsMutableObjects])
-    [(GCMutableArray *)_entities removeObject: entity];
+    [(GCMutableArray *)[self entities] removeObject: entity];
   else
     {
-      id       e = [[GCMutableArray alloc] initWithArray: _entities];
+      id       e = [[GCMutableArray alloc] initWithArray: [self entities]];
 
       [e removeObject: entity];
       ASSIGNCOPY(_entities, e);
@@ -1448,7 +1453,8 @@
          [self setName: newString];
 
          // Entites
-         if (_entities && (count = [_entities count]))
+         /* Do not access _entities until cache is triggered */
+         if ([self entities] && (count = [_entities count]))
            {
              for (i = 0; i < count; i++)
                [(EOEntity *)[_entities objectAtIndex:i] beautifyName];
@@ -1542,10 +1548,11 @@
     {
       _flags.createsMutableObjects = flag;
       
+      /* Do not access _entities until cache is triggered */
       if (_flags.createsMutableObjects)
-        _entities = [[_entities autorelease] mutableCopy];
+        _entities = [[[self entities] autorelease] mutableCopy];
       else
-        _entities = [[_entities autorelease] copy];
+        _entities = [[[self entities] autorelease] copy];
     }
 }
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]