• 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: NSToolbar Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSToolbar Problem


  • Subject: Re: NSToolbar Problem
  • From: Guy English <email@hidden>
  • Date: Fri, 1 Apr 2005 13:47:59 -0500

On Apr 1, 2005 1:28 PM, Julian Cain <email@hidden> wrote:
> Um, the are defined and draw just fine thank you. Sorry

You're just lucky. Sorry.

----------------------
_imageLeft = [[[NSImage imageNamed:@"TB_Segment_LeftCap"]
setFlipped:YES] retain];
----------------------

imageNamed: returns an NSImage*.
setFliped returns void.
retain returns an object.

What's happening here is that the NSImage is being returned into a
register then setFlipped is called on it. Since setFlipped returns
void there is ( and you're simply lucky here ) no change in the
register. Now you call retain and it picks up the value that's lying
around in the register and returns it after it's incremented the
retainCount. Your middle step is pure fluke that it works. And it's
certainly invalid code. Do you get a warning here? You should probably
get an error actually.

Guy
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >NSToolbar Problem (From: Julian Cain <email@hidden>)
 >Re: NSToolbar Problem (From: j o a r <email@hidden>)
 >Re: NSToolbar Problem (From: Julian Cain <email@hidden>)
 >Re: NSToolbar Problem (From: daniel <email@hidden>)
 >Re: NSToolbar Problem (From: Julian Cain <email@hidden>)
 >Re: NSToolbar Problem (From: Shaun Wexler <email@hidden>)
 >Re: NSToolbar Problem (From: Julian Cain <email@hidden>)

  • Prev by Date: Re: Getting app icon
  • Next by Date: Re: NSToolbar Problem
  • Previous by thread: Re: NSToolbar Problem
  • Next by thread: Re: NSToolbar Problem
  • Index(es):
    • Date
    • Thread