• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Dumb ARC question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Dumb ARC question


  • Subject: Dumb ARC question
  • From: Rick Mann <email@hidden>
  • Date: Wed, 26 Dec 2012 21:25:36 -0800

I just wrote some Objective-C++ code. It's basically just a regular Obj-C class, but makes some C++-style calls in its methods.

Anyway, I added an NSMutableData* ivar to my class, and set it with

	mInputBuffer = [NSMutableData data];

in one of the methods. Subsequent accesses, however, have resulted in it being deallocated, even though I never set mInputBuffer to NULL anywhere.

I changed the code to refer to it via a strong property, and it's fine.

I thought ARC worked the same in both cases (that is, retained the object on assignment and kept it around until the last reference was gone, even if via a regular ivar)

A bit of googling confirms this, so I'm wondering what I've done wrong.

--
Rick




_______________________________________________

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

  • Prev by Date: Model object with NSImage property in ZIP file
  • Next by Date: Re: IB - NSTableView Single Column Header Issue
  • Previous by thread: Model object with NSImage property in ZIP file
  • Next by thread: Re: Dumb ARC question
  • Index(es):
    • Date
    • Thread