mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-02-19 17:50:47 +00:00
* EOControl/EOEditingContext.m ([-_processRecentChanges]):
Invert logic for propagating deletes. ([-saveChanges]): Propagate deletes if they were not propagated yet. * EOControl/EOPrivate.h (EOHashAddTable): New compatibility function. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@21651 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9647f11503
commit
38b0f58afd
4 changed files with 72 additions and 2 deletions
|
@ -3,6 +3,13 @@
|
|||
* COPYING.LIB: Update to LGPL 2.1.
|
||||
* configure: Regenerate.
|
||||
* Update FSF Address and Copyright years.
|
||||
|
||||
* EOControl/EOEditingContext.m ([-_processRecentChanges]):
|
||||
Invert logic for propagating deletes.
|
||||
([-saveChanges]): Propagate deletes if they were not
|
||||
propagated yet.
|
||||
* EOControl/EOPrivate.h (EOHashAddTable): New compatibility
|
||||
function.
|
||||
|
||||
2005-07-10 Matt Rice <ratmice@yahoo.com>
|
||||
|
||||
|
|
|
@ -1546,7 +1546,7 @@ _mergeValueForKey(id obj, id value,
|
|||
[self _registerClearStateWithUndoManager];
|
||||
|
||||
/* Propagate deletes. */
|
||||
if (_flags.propagatesDeletesAtEndOfEvent == NO
|
||||
if (_flags.propagatesDeletesAtEndOfEvent == YES
|
||||
&& [_undoManager isUndoing] == NO
|
||||
&& [_undoManager isRedoing] == NO)
|
||||
{
|
||||
|
@ -2560,7 +2560,49 @@ _mergeValueForKey(id obj, id value,
|
|||
if (_delegateRespondsTo.willSaveChanges)
|
||||
[_delegate editingContextWillSaveChanges: self];
|
||||
|
||||
[self _processRecentChanges]; // filled lists _changedObjects, _deletedObjects, _insertedObjects, breaks relations
|
||||
/* Update _changedObjects, _deletedObjects, _insertedObjects,
|
||||
breaks relations and propagate deletes. */
|
||||
|
||||
[self _processRecentChanges];
|
||||
|
||||
/* Ayers 17.08.2005: We need to force _processRecentChanges
|
||||
to propagate deletes now. So we copy all processed objects
|
||||
to the unprocessed lists and temporarily change the
|
||||
the state of propagatesDeletesAtEndOfEvent and call
|
||||
_processRecentChanges again.
|
||||
This actually has implications wrt multithreaded access,
|
||||
but this is called under a lock so multiple savesChanges
|
||||
are protected. What is not protected is methods which do not
|
||||
lock but query the flag either directly or via method call.
|
||||
We could add a lock in the accessor method and read the state
|
||||
into a local variable during a locked access and never access
|
||||
the variable directly but this could have a significant
|
||||
performance impact. */
|
||||
|
||||
if (!_flags.propagatesDeletesAtEndOfEvent)
|
||||
{
|
||||
_flags.propagatesDeletesAtEndOfEvent = YES;
|
||||
_flags.useCommittedSnapshot = YES;
|
||||
|
||||
EOHashAddTable(_unprocessedInserts,_insertedObjects);
|
||||
EOHashAddTable(_unprocessedChanges,_changedObjects);
|
||||
EOHashAddTable(_unprocessedDeletes,_deletedObjects);
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
[self _processRecentChanges];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
_flags.propagatesDeletesAtEndOfEvent = NO;
|
||||
_flags.useCommittedSnapshot = NO;
|
||||
[localException raise];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
|
||||
_flags.propagatesDeletesAtEndOfEvent = NO;
|
||||
_flags.useCommittedSnapshot = NO;
|
||||
}
|
||||
|
||||
EOFLOGObjectLevelArgs(@"EOEditingContext", @"Unprocessed: %@",
|
||||
[self unprocessedDescription]);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#define __EOControl_EOPrivate_h__
|
||||
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSHashTable.h>
|
||||
#include "EODefines.h"
|
||||
|
||||
@class NSNumber;
|
||||
|
@ -364,6 +365,13 @@ EOGlobalID* EOEditingContext_globalIDForObjectWithImpPtr(EOEditingContext* edCon
|
|||
GDL2CONTROL_EXPORT id EOEditingContext_recordObjectGlobalIDWithImpPtr(EOEditingContext* edContext,IMP* impPtr,id object,EOGlobalID* gid);
|
||||
|
||||
|
||||
// ==== hash convienience functions ====
|
||||
|
||||
GDL2CONTROL_EXPORT void EOHashAddTable(NSHashTable *to, NSHashTable *from);
|
||||
|
||||
|
||||
// ==== Memory Management Utilities ====
|
||||
|
||||
@interface NSObject (DeallocHack)
|
||||
- (void) registerAssociationForDeallocHack:(id)object;
|
||||
@end
|
||||
|
|
|
@ -441,6 +441,19 @@ EOEditingContext_recordObjectGlobalIDWithImpPtr(EOEditingContext *edContext,
|
|||
return nil;
|
||||
};
|
||||
|
||||
void EOHashAddTable(NSHashTable *to, NSHashTable *from)
|
||||
{
|
||||
NSHashEnumerator hEnum;
|
||||
void *content;
|
||||
|
||||
hEnum = NSEnumerateHashTable (from);
|
||||
while ((content = NSNextHashEnumeratorItem (&hEnum)))
|
||||
{
|
||||
NSHashInsert(to, content);
|
||||
}
|
||||
NSEndHashTableEnumeration(&hEnum);
|
||||
}
|
||||
|
||||
static SEL eqSel;
|
||||
|
||||
@interface GDL2NonRetainingMutableArray (PrivateExceptions)
|
||||
|
|
Loading…
Reference in a new issue