Re: Crash when closing window from the menu
Re: Crash when closing window from the menu
- Subject: Re: Crash when closing window from the menu
- From: Jean-Daniel Dupas <email@hidden>
- Date: Mon, 1 Dec 2008 15:12:02 +0100
When you dealloc a datasource, a delegate or any other object that is
not retained by class that uses it, you have to unregister it.
For example, if you have an object that is datasource for its
_tableView ivar and delegate for _otherIVar ivar, you should do
something like this :
- (void)dealloc {
[_tableView setDataSource:nil];
[_otherIVar setDelegate:nil];
// other dealloc stuff
[super dealloc];
}
You should also remove it from notification center if it is registered
as observer, etc.
Not that all this stuff is useless in Garbage collected app, and
should not be duplicate in finalize.
Le 1 déc. 08 à 14:47, Andre Masse a écrit :
Hi,
I've a strange bug that happens if the window is closed by choosing
the "Close" menu and not by clicking in the window's close box. The
window contains master/detail views. I can prevent the crash if I
set the master's table view datasource to nil in dealloc but I don't
understand why this is happening...
Any idea?
Andre Masse
backtrace here:
#0 0x922d5907 in ___forwarding___ ()
#1 0x922d5a12 in __forwarding_prep_0___ ()
#2 0x94ee1cae in -[NSTableView _dataSourceValueForColumn:row:] ()
#3 0x94e63fe0 in -[NSTableView preparedCellAtColumn:row:] ()
#4 0x94e63e44 in -[NSTableView
_drawContentsAtRow:column:withCellFrame:] ()
#5 0x94e6337a in -[NSTableView drawRow:clipRect:] ()
#6 0x94e087f4 in -[NSTableView drawRowIndexes:clipRect:] ()
#7 0x94e072d8 in -[NSTableView drawRect:] ()
#8 0x94e97864 in -[NSView _drawRect:clip:] ()
#9 0x94e9635b in -[NSView
_recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#10 0x94e966f2 in -[NSView
_recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#11 0x94e94cb1 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView
:] ()
#12 0x94e95b0b in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView
:] ()
#13 0x94e95b0b in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView
:] ()
#14 0x94e95b0b in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView
:] ()
#15 0x94e95b0b in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView
:] ()
#16 0x94e95b0b in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView
:] ()
#17 0x94e945f3 in -[NSThemeFrame
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView
:] ()
#18 0x94e91117 in -[NSView
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]
()
#19 0x94dd1b77 in -[NSView displayIfNeeded] ()
#20 0x94dd1725 in -[NSWindow displayIfNeeded] ()
#21 0x94dd1548 in _handleWindowNeedsDisplay ()
#22 0x922549c2 in __CFRunLoopDoObservers ()
#23 0x92255d1c in CFRunLoopRunSpecific ()
#24 0x92256cf8 in CFRunLoopRunInMode ()
#25 0x93bce480 in RunCurrentEventLoopInMode ()
#26 0x93bce1d2 in ReceiveNextEventCommon ()
#27 0x93bce10d in BlockUntilNextEventMatchingListInMode ()
#28 0x94dcf3ed in _DPSNextEvent ()
#29 0x94dceca0 in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#30 0x94f7aac3 in -[NSButtonCell performClick:] ()
#31 0x94ea0b03 in -[NSApplication sendAction:to:from:] ()
#32 0x94f4f540 in -[NSMenu performActionForItemAtIndex:] ()
#33 0x94f4f245 in -[NSCarbonMenuImpl
performActionWithHighlightingForItemAtIndex:] ()
#34 0x94f4eecb in -[NSMenu performKeyEquivalent:] ()
#35 0x94f4d770 in -[NSApplication _handleKeyEquivalent:] ()
#36 0x94e6a733 in -[NSApplication sendEvent:] ()
#37 0x94dc7d0f in -[NSApplication run] ()
#38 0x94d94f14 in NSApplicationMain ()
#39 0x00002480 in main (argc=1, argv=0xbffff618) at /Users/andre/
development/CocoaTDH/version_courante/main.m:13
_______________________________________________
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
_______________________________________________
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