[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: addSubview: creates a loop in the views tree!
From: |
Pete French |
Subject: |
Re: addSubview: creates a loop in the views tree! |
Date: |
Sun, 18 Aug 2002 20:54:08 +0100 |
O.K., did some debugging with the aid of judicious NSLog statements.
I did the following:
1) printing out every occurance of AddSubview
2) when I get the error I print out the hierarchy of views for the view to
which the add message is being sent.
results:
The glaringly obvious problem is that the addSubview message is being sent with
itself as an argument! As a view cannot be its own subview then thats an
obvious problem.
But wierdness occurs when we look at the hierarchy:
20:39:17.183 solview[6844] Printing debug hierarchy
20:39:17.183 solview[6844] View NSView:8429a08 has superview NSBox:8429b08
20:39:17.183 solview[6844] View NSBox:8429b08 has superview NSView:83b3908
20:39:17.184 solview[6844] View NSView:83b3908 has no superview
In this the preceeding message was
20:39:17.182 solview[6844] Adding view NSView:8429a08 to view NSView:8429a08
Which is whats causing the error. So lets try and trace how the hierarchy
was constructed. We can find the messages
20:39:17.180 solview[6844] Adding view NSBox:8429b08 to view NSView:83b3908
Which shows how the box was added to the parent view. But there is no
message showing how the view 8429a08 was added as a subview of the NSBox!
The only occurrance of 8429a08 is in the message where it is being added to
itself.
So, I have two puzzles. the first being why a view should be trying to be added
to itself, and the second being how that view ever became a subview in that
hierarchy anyway (I am assuming all subviews are added with addSubview here)
Anybody got any ideas ? I can post the gmodel file if people would like to try
it on their own systems - I would like some confirmation that it occurs
elsewhere just so I know I am not going mad.
-bat.