Unit test crash inside NSTableView

2009-11-11 Thread David Catmull
I'm getting a crash in -[NSTableView _isGroupRow:] in my unit tests if I try to 
run the main run loop.

In my document's window, I have an NSOutlineView with its delegate and 
dataSource set to the window controller. In some unit tests, I want to run the 
main event loop to give some bindings a chance to do their thing, but this 
causes a crash. Once, instead of crashing, there was a message logged that some 
random class (whose name I can't remember) doesn't respond to 
-[outlineView:isGroupItem:], as if the outline view's delegate were set wrong. 
I added a check for that in the unit test and it was fine. When I run the app 
normally everything works.

I create the document by calling [[NSDocumentController 
sharedDocumentsController] openUntitledDocument:YES error:e]. Is there 
something else I need to do so that everything get set up correctly?

-- 
David Catmull
uncom...@uncommonplace.com
http://www.uncommonplace.com/

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Unit test crash inside NSTableView

2009-11-11 Thread Corbin Dunn

On Nov 11, 2009, at 8:39 AM, David Catmull wrote:

 I'm getting a crash in -[NSTableView _isGroupRow:] in my unit tests if I try 
 to run the main run loop.
 
 In my document's window, I have an NSOutlineView with its delegate and 
 dataSource set to the window controller. In some unit tests, I want to run 
 the main event loop to give some bindings a chance to do their thing, but 
 this causes a crash. Once, instead of crashing, there was a message logged 
 that some random class (whose name I can't remember) doesn't respond to 
 -[outlineView:isGroupItem:], as if the outline view's delegate were set 
 wrong. I added a check for that in the unit test and it was fine. When I run 
 the app normally everything works.

Your delegate is being deallocated too soon. Try adding a log when it gets 
dealloced (or a breakpoint) and see if the crash happens after the 
deallocation. It probably will.

--corbin





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com