numberOfRowsInTableView called after dealloc
numberOfRowsInTableView called after dealloc
- Subject: numberOfRowsInTableView called after dealloc
- From: "James J. Merkel" <email@hidden>
- Date: Wed, 5 Mar 2003 20:46:24 -0800
I have an NSTableView object in a window. The dataSource for the
tableView consists of two NSMutableArrays. When I close the window, I
release the NSWindowController which causes the dealloc for the
NSWindowController to be called. In the dealloc method I try to release
the NSMutableArrays. This causes a crash, even though the retainCount
for the NSMutableArrays is 1. I found that the reason for this is that
numberOfRowsInTableView method is called after my dealloc. It so
happens that only one of the arrays is used by numberOfRowsInTableView
. If I release the other one, everything is fine, which verifies that
it is the numberOfRowsInTableView that is causing the problem. I have
no idea why numberOfRowsInTableView is called after my dealloc. A
possible solution is to use autorelease rather than release. This seems
to work, but how do I know that numberOfRowsInTableView won't be called
after the release?
Any help would be appreciated.
Jim Merkel
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.