bug-gnustep
[Top][All Lists]
Advanced

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

[bug #29627] There is the logical error at [EODatabaseContext prepareFor


From: Sergey Golovin
Subject: [bug #29627] There is the logical error at [EODatabaseContext prepareForSaveWithCoordinator:editingContext:]
Date: Wed, 21 Apr 2010 14:42:07 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.9.1.9) Gecko/20100401 Ubuntu/9.10 (karmic) Firefox/3.5.9

URL:
  <http://savannah.gnu.org/bugs/?29627>

                 Summary: There is the logical error at [EODatabaseContext
prepareForSaveWithCoordinator:editingContext:]
                 Project: GNUstep
            Submitted by: svg
            Submitted on: Срд 21 Апр 2010 19:42:06
                Category: gdl2
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

[EODatabaseContext prepareForSaveWithCoordinator:editingContext:] makes
primary keys for objects. Making is implemented by two rounds. The objects
which are leaved without primary keys after first round have a chance to get
theirs during second one. The array noPKobjects should be filled by such
objects during first round. Now the problem can be seen in the following code
snippet (not important lines are missed):
------------------------------------------------------------
for(round=0;round<2;round++)
 {
   <...>
   if (round==1 && [noPKObjects count]==0)
        break;
   else
     {
        NSArray* array=nil;
        if (round==0)
            array=insertedObjects;
        else
          { 
            array=noPKObjects;
            <...>
          }
        count = [array count];
        if (count>0)
          {
            IMP oaiIMP=[array methodForSelector: @selector(objectAtIndex:)];

            for (i = 0; i < count; i++)
              { 
                 id object = GDL2_ObjectAtIndexWithImp(array,oaiIMP,i);
                 <...>
                 NSDictionary *objectPK;
                 objectPK = [self _primaryKeyForObject: object
raiseException: round>0];
                 <...>
                 if (objectPK)
                   {
                      <...>
                      if (round>0)
                        {
                           [noPKObjects removeObjectAtIndex:i];
                           i--;
                        };
                   }
                 else if (round>0) // the problem is here because
                                   // it only happens during 
                                   // the second phase when it
                                   // makes no sense
                   {
                     if (!noPKObjects)
                       noPKObjects=(NSMutableArray*)[NSMutableArray array];
                     [noPKObjects addObject:object];
                   }
                 
              }
     }

 }
------------------------------------------------------------

"else if (round>0)" should be replaced by "else if (round==0)" as the patch
does.





    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Срд 21 Апр 2010 19:42:06  Name: gdl2_EOAccess_2rounds.patch 
Size: 558B   By: svg

<http://savannah.gnu.org/bugs/download.php?file_id=20293>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?29627>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

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