[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Possible bug with adding subviews?
From: |
Stephen Brandon |
Subject: |
Possible bug with adding subviews? |
Date: |
Tue, 12 Feb 2002 19:07:59 +0000 |
Hi,
I converted a MacOSX nib using nib2gmodel, and am debugging the results :=(
The issue here is that GNUstep complains thus:
Uncaught exception NSInvalidArgumentException, reason: addSubview: creates a
loop in the views tree!
The problem occurs under the following conditions:
- unarchiving from gmodel file
- NSBox object ("box") has contentview "a"
- nsview "a" also appears in box's subviews array
- nsview "a" has superview "box"
- during the unarchiving of "a" (superview "box" is decoded, then [superview
addSubview:self] is called)
The exception is thrown in -[NSView addSubview:], where the box's
_content_view object is asked to add *itself*, since _content_view == "a":
if ([self isDescendantOf: aView]) {... (throws exception)
I'm not sure where the best place to fix this is. Should the unarchiver do a
check to see if the superview's contentview equals itself? (but then the
superview would never add the view to its subview list). Or should NSView
just do a check to see if a view is adding itself as a subview, and silently
ignore it?
It's also possible that the situation as described above should never
actually happen, and that either my original nib is in a mess, or nib2gmodel
made an error in converting it.
Any help welcome!
Cheers,
Stephen Brandon
- Possible bug with adding subviews?,
Stephen Brandon <=
Re: Possible bug with adding subviews?, Richard Frith-Macdonald, 2002/02/12