• 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
Re: NSLog preventing a crash?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSLog preventing a crash?


  • Subject: Re: NSLog preventing a crash?
  • From: Gregory Weston <email@hidden>
  • Date: Mon, 23 Jul 2007 13:56:43 -0400

Rob Chahin wrote:

I have an NSObject subclass that acts like a wrapper for an NSArray
of another NSObject subclass that wraps an NSDictionary.

Normally, my app crashes if I try to access one of these dictionaries
twice in a row. However, if I call:

NSLog(@"%@", [arrayWrapper methodThatJustReturnsArray]);

between the 2 attempts, the code works fine. If I call that method
but do nothing with it, i.e. removing the NSLog, the crash still occurs.


Without getting into the details of the code (for time's sake), is
there any obvious reason why this would prevent a crash from
occuring? I, for one, am confused.

Without getting into the details of the code, not one of us can tell you why a line that invokes a method you wrote seems to prevent a crash. But, of course, you should really be trying to determine why the crash happens, not why it doesn't happen.


Crashes like you're describing are almost always the result of manually releasing something that's not your responsibility to release. Depending on the code in your method that "just returns the array" it's possible you might be introducing a gratuitous retain that happens to balance the suspected gratuitous release.
_______________________________________________


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: Re: Window Level
  • Next by Date: Re: NSLog preventing a crash?
  • Previous by thread: Re: NSLog preventing a crash?
  • Next by thread: Prevent display of installed NSPreferencePane
  • Index(es):
    • Date
    • Thread