Re: NSBrower selectedCells lies
Re: NSBrower selectedCells lies
- Subject: Re: NSBrower selectedCells lies
- From: "Martin Redington" <email@hidden>
- Date: Fri, 23 May 2008 17:06:01 +0100
I instrumented all my delegate methods, and they don't seem to get
called at all during the redraw in either the normal or pathological
cases.
looking at the case where NSFocusRingTypeNone causes the same
symptoms, I put a breakpoint on drawInteriorWithFrame, and then set it
to dump a backtrace.
What I see in both the normal and pathological cases is an initial
call like this, for the clicked cell
#0 -[MMICleanerBrowserCell drawInteriorWithFrame:inView:]
(self=0x270200, _cmd=0x93ff8bd4, cellFrame={origin = {x = 0, y = 36},
size = {width = 131, height = 18}}, controlView=0x26eb30) at
/Users/martin/Documents/MMI/Cleaner/MoreBrowser/MMICleanerBrowserCell.m:126
#1 0x95141ef2 in -[NSBrowserCell highlight:withFrame:inView:] ()
#2 0x95141d16 in -[NSMatrix _highlightCell:atRow:column:andDraw:] ()
#3 0x95141b0e in -[NSMatrix highlightCell:atRow:column:] ()
#4 0x952066be in -[NSMatrix _selectRange::::] ()
#5 0x95206283 in -[NSMatrix _selectRectRange::] ()
#6 0x95205df6 in -[NSMatrix _mouseLoop::::::] ()
#7 0x95205d4d in -[NSMatrix _normalListmodeDown::::] ()
#8 0x95205c54 in -[NSMatrix _mouseDownListmode:] ()
#9 0x9513f8d7 in -[NSMatrix mouseDown:] ()
#10 0x94fc3ac3 in -[NSWindow sendEvent:] ()
#11 0x94f90714 in -[NSApplication sendEvent:] ()
#12 0x94eee0f9 in -[NSApplication run] ()
#13 0x94ebb30a in NSApplicationMain ()
#14 0x0001affc in main (argc=1, argv=0xbffff7e8) at
/Users/martin/Documents/MMI/Cleaner/MoreBrowser/main.m:13
2008-05-23 15:43:58.659 MoreBrowser[8591:613] Drawn interiorWithFrame
for 2-2 (1)
and then other cells update as a direct result of the mouse down
#0 -[MMICleanerBrowserMatrix drawRect:] (self=0x253bc0,
_cmd=0x94001630, rect={origin = {x = 0, y = 0}, size = {width = 131,
height = 36}}) at
/Users/martin/Documents/MMI/Cleaner/MoreBrowser/MMICleanerBrowserMatrix.m:102
#1 0x94fbdbbe in -[NSView _drawRect:clip:] ()
#2 0x94fbc751 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
Some calls deleted ...
#8 0x94fbcaa5 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#9 0x9512e850 in -[NSBrowser
_recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#10 0x94fbb0b4 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
()
#11 0x95132097 in -[NSBrowser
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
()
#12 0x94fbbf05 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
()
#13 0x94fbbf05 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
()
#14 0x94fba9f7 in -[NSThemeFrame
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
()
#15 0x94fb752d in -[NSView
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]
()
#16 0x94ef7f09 in -[NSView displayIfNeeded] ()
#17 0x94ef7ab9 in -[NSWindow displayIfNeeded] ()
#18 0x94ef78e0 in _handleWindowNeedsDisplay ()
#19 0x9593c9c2 in __CFRunLoopDoObservers ()
#20 0x9593dd25 in CFRunLoopRunSpecific ()
#21 0x9593ed18 in CFRunLoopRunInMode ()
#22 0x95b326a0 in RunCurrentEventLoopInMode ()
#23 0x95b323f2 in ReceiveNextEventCommon ()
#24 0x95b3232d in BlockUntilNextEventMatchingListInMode ()
#25 0x94ef57d9 in _DPSNextEvent ()
#26 0x94ef508e in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#27 0x94fc67ff in -[NSWindow nextEventMatchingMask:] ()
#28 0x95205e85 in -[NSMatrix _mouseLoop::::::] ()
#29 0x95205d4d in -[NSMatrix _normalListmodeDown::::] ()
#30 0x95205c54 in -[NSMatrix _mouseDownListmode:] ()
#31 0x9513f8d7 in -[NSMatrix mouseDown:] ()
#32 0x94fc3ac3 in -[NSWindow sendEvent:] ()
#33 0x94f90714 in -[NSApplication sendEvent:] ()
#34 0x94eee0f9 in -[NSApplication run] ()
#35 0x94ebb30a in NSApplicationMain ()
#36 0x0001affc in main (argc=1, argv=0xbffff7e8) at
/Users/martin/Documents/MMI/Cleaner/MoreBrowser/main.m:13
In the pathological case, no further updates are received, but
normally, a number of further calls to [NSMatrix drawRect] are made,
with the following stack trace.
#0 -[MMICleanerBrowserMatrix drawRect:] (self=0x253bc0,
_cmd=0x94001630, rect={origin = {x = 0, y = 0}, size = {width = 131,
height = 36}}) at
/Users/martin/Documents/MMI/Cleaner/MoreBrowser/MMICleanerBrowserMatrix.m:102
#1 0x94fbdbbe in -[NSView _drawRect:clip:] ()
#2 0x94fbc751 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
Some calls deleted
#8 0x94fbcaa5 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#9 0x9512e850 in -[NSBrowser
_recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#10 0x94fbb0b4 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
()
#11 0x95132097 in -[NSBrowser
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
()
#12 0x94fbbf05 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
()
#13 0x94fbbf05 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
()
#14 0x94fba9f7 in -[NSThemeFrame
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
()
#15 0x94fb752d in -[NSView
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]
()
#16 0x94ef7f09 in -[NSView displayIfNeeded] ()
#17 0x94ef7ab9 in -[NSWindow displayIfNeeded] ()
#18 0x94ef78e0 in _handleWindowNeedsDisplay ()
#19 0x9593c9c2 in __CFRunLoopDoObservers ()
#20 0x9593dd25 in CFRunLoopRunSpecific ()
#21 0x9593ed18 in CFRunLoopRunInMode ()
#22 0x95b326a0 in RunCurrentEventLoopInMode ()
#23 0x95b323f2 in ReceiveNextEventCommon ()
#24 0x95b3232d in BlockUntilNextEventMatchingListInMode ()
#25 0x94ef57d9 in _DPSNextEvent ()
#26 0x94ef508e in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#27 0x94eee0c5 in -[NSApplication run] ()
#28 0x94ebb30a in NSApplicationMain ()
#29 0x0001affc in main (argc=1, argv=0xbffff7e8) at
/Users/martin/Documents/MMI/Cleaner/MoreBrowser/main.m:13
I'm not so sure that the update loop is getting interrupted, but
something is preventing those later updates.
Maybe the cells just aren't getting marked as dirty for some reason.
Filed as <rdar://5959283>
On Fri, May 23, 2008 at 3:30 AM, Graham Cox <email@hidden> wrote:
> Check whether anything in your delegate is throwing an exception (NSAssert
> can throw an exception btw). That might be interrupting the update loop.
>
> hth,
>
> G.
>
>
> On 23 May 2008, at 10:44 am, Martin Redington wrote:
>
>> I've made some progress in hunting this down, although it seems a little
>> weird.
>>
>> Basically, in an NSBrowser, if you have a column with, for example,
>> three items, and you click on another,
>>
>> - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView
>> *)controlView
>>
>> gets called a few times for each item, with the the selectedCells
>> values changing appropriately and correctly during the sequence and
>> calls.
>>
>> In the case I'm running into, drawInteriorWithFrame only gets called
>> for some of the items, and only once, so the calls for the later, new
>> value of selectedCells are never made (hence "selectedCells lies").
>> *Something* seems to be stopping the later updates.
>>
>> I have a test case that replicates this behaviour, with a fairly
>> minimal classes. Oddly, when I set the the browser's focusRingType to
>> NSFocusRingTypeNone, programmatically or in the nib, I get exactly the
>> same behaviour as in my test case. When I leave it set to the default,
>> I get the correct number and sequence of drawInteriorWithFrame: calls.
>> I'll file a bug for this later on.
>>
>> Frustratingly, when I drop my app's browser classes into my minimal
>> test case, they seem to work ok. The only real difference left is in
>> my browser delegate methods - I wouldn't have expected them to break
>> this, but then I wouldn't have expected NSFocusRingTypeNone to either.
>>
>> If anyone has any clues as to what might be going on here, that would
>> be great ...
>
--
http://www.mildmanneredindustries.com/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden