Re: Newbie: Strange problem with NSTableView, check boxes and Core Data
Re: Newbie: Strange problem with NSTableView, check boxes and Core Data
- Subject: Re: Newbie: Strange problem with NSTableView, check boxes and Core Data
- From: Jonathan Oddie <email@hidden>
- Date: Thu, 2 Oct 2008 00:40:44 -0600
On Sep 29, 2008, at 5:36 PM, Corbin Dunn wrote:
On Sep 29, 2008, at 10:55 AM, Jonathan Oddie wrote:
Hi all,
I'm new on this list -- teaching myself Cocoa programming by
writing a small utility as a Core Data document-based application.
Mostly I have everything working well, but there is one strange bug
I can't isolate where a check box in a table view sometimes fails
to draw itself properly. This happens maybe one time out of ten.
Details:
- I have a Core Data entity with properties "Name" (a string) and
"Enabled" (a bool). Both are non-optional and have default values
"New" and YES, respectively.
- In my document NIB file I have an array controller set to manage
that entity. It is set to "prepare content" and "editable".
- also in the NIB, a table view with two columns: one of
checkboxes, bound to the "Enabled" property through the array
controller, and one of text fields bound to the "Name"
- an IBAction method, linked to a "new" button, which creates a new
instance of the entity with the NSEntityDescription
insertNewObjectForEntityForName:inManagedObjectContext: method
- This is a garbage-collected project.
The new document is created with no instances of the entity. When
clicking the "new" button, 9 times out of 10 everything seems fine.
When it goes wrong, either the checkbox for the newly inserted
entity doesn't draw at all, or it lacks the checkmark or the
highlight or some other visual element. There is a console message
like:
2008-09-29 11:32:56.955 IU Organ Utility v2[12568:10b] *** -
[CIFilterClassDescription _feImage]: unrecognized selector sent to
instance 0x10d32a0
2008-09-29 11:32:56.956 IU Organ Utility v2[12568:10b] Exception
*** -[CIFilterClassDescription _feImage]: unrecognized selector
sent to instance 0x10d32a0
Sometimes the class is _NSCFNumber or CIFilterShape instead of
CIFilterClassDescription. Sometimes there's no message, but the app
crashes with an EXC_BAD_ACCESS; and sometimes there's instead a
message about free() which says something about a reference count
underrun (sorry, I've been trying to repeat it while writing this
and haven't managed to).
Anyone have any ideas?
Add a breakpoint on objc_exception_throw, and debug that app. Get a
backtrace for when the exception is thrown. That may help you. See:
http://www.corbinstreehouse.com/blog/index.php/2008/08/your-most-important-breakpoint-in-cocoa/
corbin
Thanks for the advice Corbin. Below is a long backtrace, but I am not
sure it sheds much light on the problem. I will keep working at it but
since I am moving house this week I may not get much done for a while...
Jonathan
#0 0x90187e17 in objc_exception_throw
#1 0x9433434a in -[NSObject doesNotRecognizeSelector:]
#2 0x9433294c in ___forwarding___
#3 0x94332a12 in __forwarding_prep_0___
#4 0x95bdfa8c in -[CISampler _initWithImage:optionsList:]
#5 0x95bdf888 in -[CISampler initWithImage:options:]
#6 0x95bdf811 in -[CISampler initWithImage:]
#7 0x95bdf727 in +[CISampler samplerWithImage:]
#8 0x95c9f638 in -[CIFullButton outputImage]
#9 0x91663e3a in -[NSObject(NSKeyValueCoding) valueForKey:]
#10 0x95bdd530 in -[CIFilter valueForKey:]
#11 0x95d984c1 in -[CIUIBundle1 buttonResultForResolutionData:]
#12 0x95d962f1 in -[CIUIBundleBase
renderResolutionData:toBitmap:width:height:bytesPerRow:]
#13 0x95d92f83 in -[CIUIBundleBase dataForResolutionData:]
#14 0x95d93a5e in -[CIUIBundleBase dataForPPI:]
#15 0x95d8f516 in QSICreateElement
#16 0x90c0b6b4 in CUIElement::Load
#17 0x90bf53e3 in CUIRenderer::Draw1Piece
#18 0x90bf7851 in CUIRenderer::Draw
#19 0x94da43d2 in -[NSCoreUIImageRep draw]
#20 0x94da430b in -[NSCoreUIImageRep
_drawFromRect:toRect:operation:alpha:compositing:flipped:ignoreContext:]
#21 0x94d9fd43 in -[NSImage drawInRect:fromRect:operation:fraction:]
#22 0x951e50de in -[NSImage
_drawMappingAlignmentRectToRect:withState:backgroundStyle:operation:fraction:flip
:]
#23 0x94da2fc7 in -[NSButtonCell drawImage:withFrame:inView:]
#24 0x95112d97 in -[NSButtonCell
_configureAndDrawImageWithRect:cellFrame:controlView:]
#25 0x94d96c20 in -[NSButtonCell drawInteriorWithFrame:inView:]
#26 0x94ddff19 in -[NSTableView
_drawContentsAtRow:column:withCellFrame:]
#27 0x94ddf37a in -[NSTableView drawRow:clipRect:]
#28 0x94d847f4 in -[NSTableView drawRowIndexes:clipRect:]
#29 0x94d832d8 in -[NSTableView drawRect:]
#30 0x94e13864 in -[NSView _drawRect:clip:]
#31 0x94e1235b in -[NSView
_recursiveDisplayAllDirtyWithLockFocus:visRect:]
#32 0x94e126f2 in -[NSView
_recursiveDisplayAllDirtyWithLockFocus:visRect:]
#33 0x94e10cb1 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView
:]
#34 0x94e11b0b in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView
:]
#35 0x94e11b0b in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView
:]
#36 0x94e11b0b in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView
:]
#37 0x94e11b0b in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView
:]
#38 0x94e11b0b in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView
:]
#39 0x94e105f3 in -[NSThemeFrame
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView
:]
#40 0x94e0d117 in -[NSView
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]
#41 0x94d4db77 in -[NSView displayIfNeeded]
#42 0x94d4d725 in -[NSWindow displayIfNeeded]
#43 0x94d4d548 in _handleWindowNeedsDisplay
#44 0x942b19c2 in __CFRunLoopDoObservers
#45 0x942b2d1c in CFRunLoopRunSpecific
#46 0x942b3cf8 in CFRunLoopRunInMode
#47 0x911fb480 in RunCurrentEventLoopInMode
#48 0x911fb1d2 in ReceiveNextEventCommon
#49 0x911fb10d in BlockUntilNextEventMatchingListInMode
#50 0x94d4b3ed in _DPSNextEvent
#51 0x94d4aca0 in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:]
#52 0x94d43cdb in -[NSApplication run]
#53 0x94d10f14 in NSApplicationMain
#54 0x00004123 in main at 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