In my simplified example this was indeed correct, it was autoreleased and was 
deallocated on the next event cycle. I was convinced there as a problem with 
NSTextView because other views were deallocated instantly but there was good 
reason. I guess I'm just retaining it somewhere that I'll need to track down.

In trying to discover where I'm not balancing the reference counting I noticed 
that calling removeFromSuperview in that example did NOT deallocate the object 
after the autorelease pool was drained but after calling release it did. The 
NSView docs state clearly the receiver is released but I claim it was still 
retained. I'm tempted to say something is wrong with NSTextView, but probably 
not. ;)

Do I need to do something else to release ownership of the NSTextView in that 
example besides just calling removeFromSuperview? Thanks for all the answers.

textView := NSTextView.alloc.initWithFrame(CGRectMake(0, 0, 0, 0));
parent.addSubview(textView);
textView.removeFromSuperview;
textView.release;

On Jul 18, 2011, at 8:28 AM, Graham Cox wrote:

> You do know about autorelease pools, right? See whether the object survives 
> the next event cycle. I'm betting it doesn't.

Regards,
        Ryan Joseph
        thealchemistguild.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to