awakeFromNib called continuously

313 views Asked by At

I have a view based NSOutlineView within a NSView. When the view is presented in my app, the outlineview flicker's continuously. awakeFromNib is getting called repeatedly, which contains [myOutlineView reloadData]. However, once I resize the window (hence the view) the flickering subsides and awakeFromNib is no longer being called.

I presume the flickering is caused by the repeated calling of reloadData in awakeFromNib. What I can't determine is why awakeFromNib would be called continuously. I understand that it is called every time a NSTableCellView is created by NSOutline (here), but this doesn't explain why it would be called continuously.

Since this behaviour would stop once I resized the window, I was suspicious of the NSScrollView in which the NSOutlineview is embedded in, but I don't now how to confirm this or more importantly how to fix it.

So can anyone give me some guidance on what could be causing this behaviour?

Edit

This is the stack trace with a break at awakeFromNib, based on this is does look like the creation of a NSTableCellView that calls the awakeFromNib, but why is this done continuously?

    frame #1: 0x00007fff8cfd3b5f AppKit`-[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1223
frame #2: 0x00007fff8d077e7c AppKit`-[NSNib _instantiateNibWithExternalNameTable:] + 600
frame #3: 0x00007fff8d19139b AppKit`-[NSNib instantiateNibWithExternalNameTable:] + 17
frame #4: 0x00007fff8d09c278 AppKit`-[NSTableRowData _unarchiveViewWithIdentifier:owner:] + 526
frame #5: 0x00007fff8d09bedd AppKit`-[NSOutlineView makeViewWithIdentifier:owner:] + 48
frame #6: 0x0000000100039c03 Allocator`-[SBRebalanceViewController outlineView:viewForTableColumn:item:](self=0x00006080003c03c0, _cmd=0x00007fff8da60816, outlineView=0x0000000100427ce0, tableColumn=0x000060800009f0e0, item=0x000060000084b580) + 1315 at SBRebalanceViewController.m:146
frame #7: 0x00007fff8d09f964 AppKit`-[NSTableView(NSTableViewViewBased) makeViewForTableColumn:row:] + 77
frame #8: 0x00007fff8d09ec97 AppKit`-[NSTableRowData _addViewToRowView:atColumn:row:] + 305
frame #9: 0x00007fff8d09e9ca AppKit`-[NSTableRowData _addViewsToRowView:atRow:] + 191
frame #10: 0x00007fff8d09babe AppKit`-[NSTableRowData _addRowViewForVisibleRow:withPriorView:] + 421
frame #11: 0x00007fff8d09b83c AppKit`-[NSTableRowData _addRowViewForVisibleRow:withPriorRowIndex:inDictionary:withRowAnimation:] + 278
frame #12: 0x00007fff8d09a906 AppKit`-[NSTableRowData _unsafeUpdateVisibleRowEntries] + 1640
frame #13: 0x00007fff8d09a19c AppKit`-[NSTableRowData updateVisibleRowViews] + 230
frame #14: 0x00007fff8d099dc4 AppKit`-[NSTableView layout] + 165
frame #15: 0x00007fff8d098e1d AppKit`-[NSView _layoutSubtreeWithOldSize:] + 325
frame #16: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #17: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #18: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #19: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #20: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #21: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #22: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #23: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #24: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #25: 0x00007fff8d07e584 AppKit`-[NSView layoutSubtreeIfNeeded] + 883
frame #26: 0x00007fff8d746688 AppKit`_NSViewLayoutSubtreesThatUseAutolayoutIfNeeded + 71
frame #27: 0x00007fff8d1097d1 AppKit`-[NSWindow(NSConstraintBasedLayout) _layoutViewTree] + 84
frame #28: 0x00007fff8d139d9d AppKit`-[NSWindow(NSConstraintBasedLayout) layoutIfNeeded] + 214
frame #29: 0x00007fff8d139c86 AppKit`-[NSView _layoutAtWindowLevelIfNeeded] + 80
frame #30: 0x00007fff8d13c3c3 AppKit`-[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 48
frame #31: 0x00007fff8d11c2fa AppKit`-[NSView displayIfNeeded] + 1680
frame #32: 0x00007fff8d18174e AppKit`_handleWindowNeedsDisplayOrLayoutOrUpdateConstraints + 884
frame #33: 0x00007fff8d757061 AppKit`__83-[NSWindow _postWindowNeedsDisplayOrLayoutOrUpdateConstraintsUnlessPostingDisabled]_block_invoke1331 + 46
frame #34: 0x00007fff904efe17 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
frame #35: 0x00007fff904efd87 CoreFoundation`__CFRunLoopDoObservers + 391
frame #36: 0x00007fff904e1468 CoreFoundation`__CFRunLoopRun + 776
frame #37: 0x00007fff904e0f25 CoreFoundation`CFRunLoopRunSpecific + 309
frame #38: 0x00007fff91192a0d HIToolbox`RunCurrentEventLoopInMode + 226
frame #39: 0x00007fff91192685 HIToolbox`ReceiveNextEventCommon + 173
frame #40: 0x00007fff911925bc HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 65
frame #41: 0x00007fff8cfe526e AppKit`_DPSNextEvent + 1434
frame #42: 0x00007fff8cfe48bb AppKit`-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122
frame #43: 0x00007fff8cfd89bc AppKit`-[NSApplication run] + 553
frame #44: 0x00007fff8cfc37a3 AppKit`NSApplicationMain + 940
frame #45: 0x0000000100007f02 Allocator`main(argc=7, argv=0x00007fff5fbff7f8) + 34 at main.m:13
0

There are 0 answers