• 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: Adding NSLog() changes behavior
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding NSLog() changes behavior


  • Subject: Re: Adding NSLog() changes behavior
  • From: Wade Tregaskis <email@hidden>
  • Date: Wed, 17 Mar 2004 01:05:50 +1100

It's probably not your problem in this case, but it might be:

- (void)setImage:(NSImage*)newImage {

if ( image ) [image release];
image = [newImage retain];

What if newImage == image? You may have just deallocated it. Your code should read something more like this:

if (image != newImage) {
[newImage retain];
[image release];
image = newImage;

// Do stuff
}

Since you're not seeing any crashing behaviour I doubt this is the problem you're actually seeing, but hopefully now you'll be able to avoid this particular bug in future.

Wade Tregaskis
-- Sed quis custodiet ipsos custodes?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Adding NSLog() changes behavior (From: Michael Becker <email@hidden>)

  • Prev by Date: Re: stopTracking in NSButtonCell
  • Next by Date: Re: Adding NSLog() changes behavior
  • Previous by thread: Adding NSLog() changes behavior
  • Next by thread: Re: Adding NSLog() changes behavior
  • Index(es):
    • Date
    • Thread