From a7f90ca35955fc87d5ed67d31e90520c2112a209 Mon Sep 17 00:00:00 2001 From: Matt Rice Date: Mon, 2 Oct 2006 07:29:29 +0000 Subject: [PATCH] * EOAccess/EOEntityPriv.h: Rename setParentEntity: to _setParentEntity:. * EOAccess/EOEntity.m (-addSubEntity:): Ditto. (-removeSubEntity:): Ditto, and check that self is the parent before setting to nil. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@23707 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 8 ++++++++ EOAccess/EOEntity.m | 11 +++++------ EOAccess/EOEntityPriv.h | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7c102d7..813abae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-10-02 Matt Rice + + * EOAccess/EOEntityPriv.h: Rename setParentEntity: to + _setParentEntity:. + * EOAccess/EOEntity.m (-addSubEntity:): Ditto. + (-removeSubEntity:): Ditto, and check that self is the parent before + setting to nil. + 2006-10-01 Matt Rice * EOAdaptors/SQLiteAdaptor/: Initial import of SQLite3 adaptor. diff --git a/EOAccess/EOEntity.m b/EOAccess/EOEntity.m index f7f2577..7b02c31 100644 --- a/EOAccess/EOEntity.m +++ b/EOAccess/EOEntity.m @@ -2337,13 +2337,14 @@ createInstanceWithEditingContext:globalID:zone: [self willChange]; [_subEntities addObject: child]; [[child parentEntity] removeSubEntity:self]; - [child setParentEntity: self]; + [child _setParentEntity: self]; } - (void)removeSubEntity: (EOEntity *)child { [self willChange]; - [child setParentEntity: nil]; + if ([child parentEntity] == self) + [child _setParentEntity: nil]; [_subEntities removeObject: child]; } @@ -2697,10 +2698,8 @@ createInstanceWithEditingContext:globalID:zone: _model = model; } -/* TODO this method should probably be private. - it doesn't tell the parent we are a subEntity and since - -addSubEntity: calls it doing so would cause a recursive loop */ -- (void)setParentEntity: (EOEntity *)parent +/* only for private usage of -addSubEntity: and -removeSubEntity: */ +- (void)_setParentEntity: (EOEntity *)parent { [self willChange]; // TODO: verify ASSIGN(_parent, parent); diff --git a/EOAccess/EOEntityPriv.h b/EOAccess/EOEntityPriv.h index 1001f01..b115bfd 100644 --- a/EOAccess/EOEntityPriv.h +++ b/EOAccess/EOEntityPriv.h @@ -43,7 +43,7 @@ - (BOOL)createsMutableObjects; - (void)_setModel: (EOModel *)model; -- (void)setParentEntity: (EOEntity *)parent; +- (void)_setParentEntity: (EOEntity *)parent; -(Class)_classForInstances; - (void)_setInternalInfo: (NSDictionary *)dictionary;