From fe990f712f42a90898c92b316398d5440809d369 Mon Sep 17 00:00:00 2001 From: Nicola Pero Date: Fri, 17 Dec 1999 23:24:44 +0000 Subject: [PATCH] Changed decoding to support decoding of NSBox too (that class is special because it overrides -addSubview:) git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5566 72102866-910b-0410-8b05-ffd578937521 --- Source/NSView.m | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Source/NSView.m b/Source/NSView.m index 998a618ff..9a884f565 100644 --- a/Source/NSView.m +++ b/Source/NSView.m @@ -2504,7 +2504,23 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level) e = [subs objectEnumerator]; while ((sub = [e nextObject]) != nil) { - [self addSubview: sub]; + // We can't use [self addSubview: sub]; because NSBox overrides + // that method: we need to take the long way. + if ([self isDescendantOf: sub]) + { + NSLog(@"Operation addSubview: creates a loop in the views tree!\n"); + continue; + } + RETAIN (sub); + [sub removeFromSuperview]; + [sub viewWillMoveToWindow: window]; + [sub viewWillMoveToSuperview: self]; + [sub setNextResponder: self]; + [sub_views addObject: sub]; + _rFlags.has_subviews = 1; + [sub resetCursorRects]; + [sub setNeedsDisplay: YES]; + RELEASE(sub); } RELEASE(subs);