<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Adding Items to the Status Bar</title>
	<atom:link href="http://www.mac-developer-network.com/videotraining/intermediate/vid002/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mac-developer-network.com/videotraining/intermediate/vid002/</link>
	<description></description>
	<lastBuildDate>Sun, 14 Mar 2010 14:10:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Scotty</title>
		<link>http://www.mac-developer-network.com/videotraining/intermediate/vid002/comment-page-1/#comment-206</link>
		<dc:creator>Scotty</dc:creator>
		<pubDate>Mon, 09 Mar 2009 11:15:39 +0000</pubDate>
		<guid isPermaLink="false">http://new.mac-developer-network.com/?p=248#comment-206</guid>
		<description>The code in the video does miss the statusItem=nil out.
I have added a note to the video to point this out.
The sample code that comes with the course in however is (and always has been) correct and does contain the missing line.</description>
		<content:encoded><![CDATA[<p>The code in the video does miss the statusItem=nil out.<br />
I have added a note to the video to point this out.<br />
The sample code that comes with the course in however is (and always has been) correct and does contain the missing line.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Yank</title>
		<link>http://www.mac-developer-network.com/videotraining/intermediate/vid002/comment-page-1/#comment-205</link>
		<dc:creator>Kevin Yank</dc:creator>
		<pubDate>Mon, 09 Mar 2009 02:16:36 +0000</pubDate>
		<guid isPermaLink="false">http://new.mac-developer-network.com/?p=248#comment-205</guid>
		<description>As craibuc has pointed out, there is a glaring bug in this example. In the removeStatusItem method, statusItem is released, but it is not set to nil. As a result, the next call to buttonClicked results in removeStatusItem being triggered again, and the program crashing.

Here is the corrected code for removeStatusItem:

- (void) removeStatusItem
{
	[[NSStatusBar systemStatusBar] removeStatusItem:statusItem];
	[statusItem release];
	statusItem = nil; // THIS LINE ADDED TO PREVENT CRASH
	[button setTitle:@&quot;Add Status Item&quot;];
}</description>
		<content:encoded><![CDATA[<p>As craibuc has pointed out, there is a glaring bug in this example. In the removeStatusItem method, statusItem is released, but it is not set to nil. As a result, the next call to buttonClicked results in removeStatusItem being triggered again, and the program crashing.</p>
<p>Here is the corrected code for removeStatusItem:</p>
<p>- (void) removeStatusItem<br />
{<br />
	[[NSStatusBar systemStatusBar] removeStatusItem:statusItem];<br />
	[statusItem release];<br />
	statusItem = nil; // THIS LINE ADDED TO PREVENT CRASH<br />
	[button setTitle:@"Add Status Item"];<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: craibuc</title>
		<link>http://www.mac-developer-network.com/videotraining/intermediate/vid002/comment-page-1/#comment-133</link>
		<dc:creator>craibuc</dc:creator>
		<pubDate>Wed, 11 Feb 2009 21:43:39 +0000</pubDate>
		<guid isPermaLink="false">http://new.mac-developer-network.com/?p=248#comment-133</guid>
		<description>looks like the statusItem = nil; line was not mentioned in the video, but is in the source.</description>
		<content:encoded><![CDATA[<p>looks like the statusItem = nil; line was not mentioned in the video, but is in the source.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: craibuc</title>
		<link>http://www.mac-developer-network.com/videotraining/intermediate/vid002/comment-page-1/#comment-132</link>
		<dc:creator>craibuc</dc:creator>
		<pubDate>Wed, 11 Feb 2009 21:18:52 +0000</pubDate>
		<guid isPermaLink="false">http://new.mac-developer-network.com/?p=248#comment-132</guid>
		<description>Thanks, I enjoyed the tutorial.

I think there is an error w/ the code.  If you add a statusItem, remove it, then try to add it again, the [self removeStatusItem] message is executed.  Are you certain that (statusItem == nil) is right test?</description>
		<content:encoded><![CDATA[<p>Thanks, I enjoyed the tutorial.</p>
<p>I think there is an error w/ the code.  If you add a statusItem, remove it, then try to add it again, the [self removeStatusItem] message is executed.  Are you certain that (statusItem == nil) is right test?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
