On Wed, Jun 17, 2009 at 10:10 PM, Jim Correia wrote:
> On Wed, Jun 17, 2009 at 9:51 PM, Bill Bumgarner wrote:
>
>> You can't assume that the container didn't make a copy or do something else.
>>
>> If you need the object, you should hold a retain.
>
> In general, I agree. However, the following co
On Wed, Jun 17, 2009 at 9:51 PM, Bill Bumgarner wrote:
> On Jun 17, 2009, at 8:48 PM, Nathan Vander Wilt wrote:
>>>
>>> In the meantime, the explicit case you present is always going to be
>>> fraught with peril, because after you release o, you have relinquished
>>> all rights to it. It's now a w
On Wed, Jun 17, 2009 at 9:51 PM, Bill Bumgarner wrote:
> You can't assume that the container didn't make a copy or do something else.
>
> If you need the object, you should hold a retain.
In general, I agree. However, the following code is also problematic:
[o release];
[testTable setObject:[te
On Wed, Jun 17, 2009 at 6:48 PM, Nathan Vander
Wilt wrote:
> Isn't it acceptable practice to let a container object I hold to maintain
> its objects on my behalf?
Not explicitly, no. Take -[NSWindowController delegate], for example.
Because delegates are a weak reference, the contract is explici
On Jun 17, 2009, at 8:48 PM, Nathan Vander Wilt wrote:
In the meantime, the explicit case you present is always going to be
fraught with peril, because after you release o, you have
relinquished
all rights to it. It's now a weak reference.
Isn't it acceptable practice to let a container obj
On Jun 17, 2009, at 6:44 PM, Kyle Sluder wrote:
On Wed, Jun 17, 2009 at 6:33 PM, Nathan Vander
Wilt wrote:
I could find no documentation to the effect that re-assigning an
object is
not allowed, so can I assume this is indeed unintentional? If so,
I've got
this test case in project form an
On Wed, Jun 17, 2009 at 6:33 PM, Nathan Vander
Wilt wrote:
> I could find no documentation to the effect that re-assigning an object is
> not allowed, so can I assume this is indeed unintentional? If so, I've got
> this test case in project form and would be happy to file a bug.
Please do file a b
The following (simplified test case) code will crash with
NSZombieEnabled:
NSMapTable* testTable = [NSMapTable mapTableWithStrongToStrongObjects];
NSString* o = [@"test_object" mutableCopy];
NSString* k = @"test_key";
[testTable setObject:o forKey:k];
[o release];
[testTable setObject:o forKey: