Value of self changes
Value of self changes
- Subject: Value of self changes
- From: Jerry Krinock <email@hidden>
- Date: Thu, 14 Nov 2013 23:41:23 -0800
Several years ago, I subclassed NSPopUpButtonCell and am using it as a table header cell, so the user can select which attribute is displayed in the column. Maybe this was not a good idea, but anyhow…
A few years ago, I noticed a rare, unreproducible bug in my app wherein this cell would receive -drawWithFrame:inView:, but the value of self is *different* than the original value of self, which I'd stored in an instance variable during the -init of this instance. Weird! (I added this instance variable for the purpose of debugging this problem.) The cell then gets a -dealloc message, again with the “new self" shortly thereafter, and I’ve worked around the crashes which would ensue by no-opping these methods if self != the original self. It does leak, of course.
In 10.9, I see this bug occurring much more frequently. I still don’t know how to reproduce it from launch but, at this moment, I get a handful of them whenever the width of the table columns that contain these cells is reduced. I see them showing up in the Allocations tool in Instruments. When I “po” them in the Debug Console, they tell me they are MyFooeyCell objects, and in general appear to be a copy of the original “self". Allocations lists their “Responsible Caller” as NSCopyObject. So I put breakpoints in +[MyFooeyCell alloc], -[MyFooeyCell init], -[MyFooeyCell copyWithZone:], and _NSCopyObject. But none of them ever break. These phonies seem to appear out of nowhere.
Can anyone suggest how ’self’ could be changed?
I realize this is probably a good lesson in Why It’s a Bad Idea to Use Non-Standard Controls, and if I spend too much more time on this, I’ll probably rip it out and put in more conventional column-attribute controls, probably a checkbox or a checkmark on/off menu item for each attribute.
But I sure would like to know how ‘self’ could be changed.
_______________________________________________
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