FROM : Martin Redington
DATE : Mon Mar 17 20:43:15 2008
I overrode -[NSTableView setFrameSize:] in my outline view class, so
that it only calls super if the size has really changed.
This seems to fix the issue - setFrameSize: gets called a few times
as I add the view - the first few times the values haven't changed.
By the time they do change, the view's window seems to have been set.
On 17 Mar 2008, at 19:12, Martin Redington wrote:
>
> I overrode lockFocus, and stuck a breakpoint on it.
>
> #0 0x004f87ea in -[MyOutlineView lockFocus] at MyOutlineView.m:75
> #1 0x93310315 in -[NSView
> _recursiveDisplayAllDirtyWithLockFocus:visRect:]
> #2 0x9332238f in _recursiveDisplayInRect2
> #3 0x9083eac0 in CFArrayApplyFunction
> #4 0x93310633 in -[NSView
> _recursiveDisplayAllDirtyWithLockFocus:visRect:]
> #5 0x9330f493 in -[NSView
> _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisib
> leRectForView:topView:]
> #6 0x9330e382 in -[NSView
> _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]
> #7 0x9330dcae in -[NSView displayIfNeeded]
> #8 0x933043ab in -[NSClipView _immediateScrollToPoint:]
> #9 0x9343bd92 in -[NSScrollView scrollClipView:toPoint:]
> #10 0x932cf34f in -[NSClipView _scrollTo:animate:]
> #11 0x932cee3b in -[NSClipView _scrollTo:]
> #12 0x932cecc3 in -[NSClipView _reflectDocumentViewFrameChange]
> #13 0x932acc75 in -[NSView _postFrameChangeNotification]
> #14 0x932cdd75 in -[NSControl setFrameSize:]
> #15 0x933a256d in -[NSTableView setFrameSize:]
> #16 0x933a0c82 in -[NSTableView tile]
> #17 0x933a09d5 in -[NSTableView _tileAndRedisplayAll]
> #18 0x932aa113 in -[NSView _setSuperview:]
> #19 0x933a3f86 in -[NSTableView _setSuperview:]
> #20 0x932a9d51 in -[NSView addSubview:]
> #21 0x932c72cf in -[NSClipView setDocumentView:]
> #22 0x932c70d0 in -[NSScrollView setDocumentView:]
> #23 0x00091f2b in -[MyController(Private) setOutlineView:] at
> MyController.m:3967
>
> When lockFocus is called, the MyOutlineView has its superview set,
> but not its window.
>
> Its possible that window is set lazily, and this is normal, but it
> seems to be non-nil every time it gets past that point without
> erroring.
>
> The other odd thing is that I don't see lockFocus get called at all
> on -[NSScrollView setDocumentView:] when there's no error, or when
> my other outline view gets set.
>
> Presumably, something in the state of that outline view is kicking
> off the redraw before the view is ready.
>
>
> On 17 Mar 2008, at 17:45, Martin Redington wrote:
>
>>
>> On 17 Mar 2008, at 17:07, Michael Nickerson wrote:
>>
>>>
>>> On Mar 17, 2008, at 9:06 AM, Martin Redington wrote:
>>>
>>>>
>>>> I'm seeing the following error
>>>>
>>>> 2008-03-17 12:42:11.916 MyApp[11155] *** Assertion failure in -
>>>> [MyOutlineView lockFocus], AppKit.subproj/NSView.m:3248
>>>> 2008-03-17 12:42:11.917 MyApp[11155] lockFocus sent to a view
>>>> whose window is deferred and does not yet have a corresponding
>>>> platform window
>>>>
>>>
>>> You usually run into this error when a view tries to draw to a
>>> window that hasn't been displayed at all yet. I don't know if
>>> this is the case for you, since you're talking about swapping
>>> views, though - are you actually swapping out windows when you do
>>> this?
>>>
>>> Anyway, you can try to make the window non-deferred (you can
>>> deselect the checkbox for that in IB) and see if you get the
>>> error then. Doing that makes the window make a connection to the
>>> window server when it's created rather than when it's first
>>> displayed.
>>
>> The window is a single window app. Making the window non-deferred
>> makes no difference.
>>
>>>
>>> If that doesn't help, is the scroll view you're adding the
>>> outline view to part of the view hierarchy when you do that?
>>> Maybe there was a bug in Tiger where the scroll view tried to
>>> display the document view immediately when it's set and if it's
>>> not actually part of a window I suppose this might pop up.
>>> That's all just a guess, though.
>>
>> Yep. The scrollview is the place holder for the views, so that's
>> always in place.
>>
>> I'll try and get a test case together - with a bit of luck I'll
>> find a workaround while I'm doing that.
>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (<email_removed>)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/m.redington%
>> 40ucl.ac.uk
>>
>> This email sent to m.<email_removed>
>>
>
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/m.redington%
> 40ucl.ac.uk
>
> This email sent to m.<email_removed>
>
DATE : Mon Mar 17 20:43:15 2008
I overrode -[NSTableView setFrameSize:] in my outline view class, so
that it only calls super if the size has really changed.
This seems to fix the issue - setFrameSize: gets called a few times
as I add the view - the first few times the values haven't changed.
By the time they do change, the view's window seems to have been set.
On 17 Mar 2008, at 19:12, Martin Redington wrote:
>
> I overrode lockFocus, and stuck a breakpoint on it.
>
> #0 0x004f87ea in -[MyOutlineView lockFocus] at MyOutlineView.m:75
> #1 0x93310315 in -[NSView
> _recursiveDisplayAllDirtyWithLockFocus:visRect:]
> #2 0x9332238f in _recursiveDisplayInRect2
> #3 0x9083eac0 in CFArrayApplyFunction
> #4 0x93310633 in -[NSView
> _recursiveDisplayAllDirtyWithLockFocus:visRect:]
> #5 0x9330f493 in -[NSView
> _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisib
> leRectForView:topView:]
> #6 0x9330e382 in -[NSView
> _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]
> #7 0x9330dcae in -[NSView displayIfNeeded]
> #8 0x933043ab in -[NSClipView _immediateScrollToPoint:]
> #9 0x9343bd92 in -[NSScrollView scrollClipView:toPoint:]
> #10 0x932cf34f in -[NSClipView _scrollTo:animate:]
> #11 0x932cee3b in -[NSClipView _scrollTo:]
> #12 0x932cecc3 in -[NSClipView _reflectDocumentViewFrameChange]
> #13 0x932acc75 in -[NSView _postFrameChangeNotification]
> #14 0x932cdd75 in -[NSControl setFrameSize:]
> #15 0x933a256d in -[NSTableView setFrameSize:]
> #16 0x933a0c82 in -[NSTableView tile]
> #17 0x933a09d5 in -[NSTableView _tileAndRedisplayAll]
> #18 0x932aa113 in -[NSView _setSuperview:]
> #19 0x933a3f86 in -[NSTableView _setSuperview:]
> #20 0x932a9d51 in -[NSView addSubview:]
> #21 0x932c72cf in -[NSClipView setDocumentView:]
> #22 0x932c70d0 in -[NSScrollView setDocumentView:]
> #23 0x00091f2b in -[MyController(Private) setOutlineView:] at
> MyController.m:3967
>
> When lockFocus is called, the MyOutlineView has its superview set,
> but not its window.
>
> Its possible that window is set lazily, and this is normal, but it
> seems to be non-nil every time it gets past that point without
> erroring.
>
> The other odd thing is that I don't see lockFocus get called at all
> on -[NSScrollView setDocumentView:] when there's no error, or when
> my other outline view gets set.
>
> Presumably, something in the state of that outline view is kicking
> off the redraw before the view is ready.
>
>
> On 17 Mar 2008, at 17:45, Martin Redington wrote:
>
>>
>> On 17 Mar 2008, at 17:07, Michael Nickerson wrote:
>>
>>>
>>> On Mar 17, 2008, at 9:06 AM, Martin Redington wrote:
>>>
>>>>
>>>> I'm seeing the following error
>>>>
>>>> 2008-03-17 12:42:11.916 MyApp[11155] *** Assertion failure in -
>>>> [MyOutlineView lockFocus], AppKit.subproj/NSView.m:3248
>>>> 2008-03-17 12:42:11.917 MyApp[11155] lockFocus sent to a view
>>>> whose window is deferred and does not yet have a corresponding
>>>> platform window
>>>>
>>>
>>> You usually run into this error when a view tries to draw to a
>>> window that hasn't been displayed at all yet. I don't know if
>>> this is the case for you, since you're talking about swapping
>>> views, though - are you actually swapping out windows when you do
>>> this?
>>>
>>> Anyway, you can try to make the window non-deferred (you can
>>> deselect the checkbox for that in IB) and see if you get the
>>> error then. Doing that makes the window make a connection to the
>>> window server when it's created rather than when it's first
>>> displayed.
>>
>> The window is a single window app. Making the window non-deferred
>> makes no difference.
>>
>>>
>>> If that doesn't help, is the scroll view you're adding the
>>> outline view to part of the view hierarchy when you do that?
>>> Maybe there was a bug in Tiger where the scroll view tried to
>>> display the document view immediately when it's set and if it's
>>> not actually part of a window I suppose this might pop up.
>>> That's all just a guess, though.
>>
>> Yep. The scrollview is the place holder for the views, so that's
>> always in place.
>>
>> I'll try and get a test case together - with a bit of luck I'll
>> find a workaround while I'm doing that.
>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (<email_removed>)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/m.redington%
>> 40ucl.ac.uk
>>
>> This email sent to m.<email_removed>
>>
>
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/m.redington%
> 40ucl.ac.uk
>
> This email sent to m.<email_removed>
>
| Related mails | Author | Date |
|---|---|---|
| Martin Redington | Mar 17, 14:06 | |
| Michael Nickerson | Mar 17, 18:07 | |
| Martin Redington | Mar 17, 18:45 | |
| Martin Redington | Mar 17, 20:12 | |
| Martin Redington | Mar 17, 20:43 |






Cocoa mail archive

