Skip to content

Commit 058e029

Browse files
committed
Fixing an old (but hopefully rare) iteration/mutation bug.
1 parent 080fc6b commit 058e029

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

cocos2d/CCNode.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ A common user pattern in building a Cocos2d game is to subclass CCNode, add it t
106106
NSMutableArray *_children;
107107

108108
// Weak ref to parent.
109-
CCNode *__unsafe_unretained _parent;
109+
__weak CCNode *_parent;
110110

111111
// A tag any name you want to assign to the node
112112
NSString* _name;
@@ -364,7 +364,7 @@ A common user pattern in building a Cocos2d game is to subclass CCNode, add it t
364364
-(void) removeAllChildrenWithCleanup:(BOOL)cleanup;
365365

366366
/** A weak reference to the parent. */
367-
@property(nonatomic,readwrite,unsafe_unretained) CCNode* parent;
367+
@property(nonatomic,readwrite,weak) CCNode* parent;
368368

369369
/** Array of child nodes. */
370370
@property(nonatomic,readonly) NSArray *children;

cocos2d/CCNode.m

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,6 @@ - (NSString*) description
206206
- (void) dealloc
207207
{
208208
CCLOGINFO( @"cocos2d: deallocing %@", self);
209-
210-
211-
// children
212-
for (CCNode* child in _children)
213-
child.parent = nil;
214-
215-
216209
}
217210

218211
#pragma mark Setters

0 commit comments

Comments
 (0)