bugGNUstep - Bugs: bug #29627, There is the logical error at...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #29627: There is the logical error at [EODatabaseContext prepareForSaveWithCoordinator:editingContext:]

Submitted by:  Sergei Golovin <svg>
Submitted on:  Wed 21 Apr 2010 02:42:06 PM UTC  
 
Category: gdl2Severity: 3 - Normal
Item Group: BugStatus: Fixed
Privacy: PublicAssigned to: David Ayers <ayers>
Open/Closed: Closed

Sat 24 Apr 2010 02:09:06 PM UTC, comment #1:

Thanks! Fix committed.

David Ayers <ayers>
Project MemberIn charge of this item.
Wed 21 Apr 2010 02:42:06 PM UTC, original submission:

[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.

Sergei Golovin <svg>

 

Attached Files
file #20293:  gdl2_EOAccess_2rounds.patch added by svg (558B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by ayers (Posted a comment)
  • -unavailable- added by svg (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 24 Apr 2010 02:09:06 PM UTCayersStatusNone=>Fixed
      Assigned toNone=>ayers
      Open/ClosedOpen=>Closed
    Wed 21 Apr 2010 02:42:06 PM UTCsvgAttached File-=>Added gdl2_EOAccess_2rounds.patch, #20293

    Back to the top


    Powered by Savane 3.1-cleanup1