<?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: Swing garbage collection &#8211; problems with the observer pattern</title>
	<atom:link href="http://www.objectdefinitions.com/odblog/2007/swing-garbage-collection-problems-with-the-observer-pattern/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.objectdefinitions.com/odblog/2007/swing-garbage-collection-problems-with-the-observer-pattern/</link>
	<description>Software Development - random theories, code snippits and opinions</description>
	<lastBuildDate>Tue, 18 Oct 2011 23:30:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Nick</title>
		<link>http://www.objectdefinitions.com/odblog/2007/swing-garbage-collection-problems-with-the-observer-pattern/comment-page-1/#comment-2017</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Mon, 23 Feb 2009 13:54:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.objectdefinitions.com/odblog/2007/swing-garbage-collection-problems-with-the-observer-pattern/#comment-2017</guid>
		<description>Bez,

You were spot on there, how did I let that one slip through? 
Thanks for finding that and pointing it out, I have revised the example

thanks

Nick</description>
		<content:encoded><![CDATA[<p>Bez,</p>
<p>You were spot on there, how did I let that one slip through?<br />
Thanks for finding that and pointing it out, I have revised the example</p>
<p>thanks</p>
<p>Nick</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bez</title>
		<link>http://www.objectdefinitions.com/odblog/2007/swing-garbage-collection-problems-with-the-observer-pattern/comment-page-1/#comment-2016</link>
		<dc:creator>bez</dc:creator>
		<pubDate>Mon, 23 Feb 2009 13:34:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.objectdefinitions.com/odblog/2007/swing-garbage-collection-problems-with-the-observer-pattern/#comment-2016</guid>
		<description>There is a slight bug in your implementation of WeakRefActionListener.actionPerformed(), in that the reference may be nulled in between the two calls to get().

To fix it, hold a local strong reference from a single call:

  public void actionPerformed(ActionEvent e)
  {
    ActionListener delegate = actionListenerDelegate.get();
    if (delegate != null)
    {
      delegate.actionPerformed(e);
    }
  }</description>
		<content:encoded><![CDATA[<p>There is a slight bug in your implementation of WeakRefActionListener.actionPerformed(), in that the reference may be nulled in between the two calls to get().</p>
<p>To fix it, hold a local strong reference from a single call:</p>
<p>  public void actionPerformed(ActionEvent e)<br />
  {<br />
    ActionListener delegate = actionListenerDelegate.get();<br />
    if (delegate != null)<br />
    {<br />
      delegate.actionPerformed(e);<br />
    }<br />
  }</p>
]]></content:encoded>
	</item>
</channel>
</rss>

