Author: smartini Date: Thu Feb 14 17:35:10 2013 New Revision: 1446281 URL: http://svn.apache.org/r1446281 Log: PIVOT-861: apply Workaround number 2
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/ButtonData.java pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/media/Image.java Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/ButtonData.java URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/ButtonData.java?rev=1446281&r1=1446280&r2=1446281&view=diff ============================================================================== --- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/ButtonData.java (original) +++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/ButtonData.java Thu Feb 14 17:35:10 2013 @@ -71,15 +71,16 @@ public class ButtonData { } Image iconLocal = (Image)ApplicationContext.getResourceCache().get(iconURL); - if (iconLocal == null) { try { iconLocal = Image.load(iconURL); + ApplicationContext.getResourceCache().put(iconURL, iconLocal); } catch (TaskExecutionException exception) { throw new IllegalArgumentException(exception); } - ApplicationContext.getResourceCache().put(iconURL, iconLocal); + } else { + iconLocal.clearImageListeners(); } setIcon(iconLocal); Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/media/Image.java URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/media/Image.java?rev=1446281&r1=1446280&r2=1446281&view=diff ============================================================================== --- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/media/Image.java (original) +++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/media/Image.java Thu Feb 14 17:35:10 2013 @@ -139,6 +139,10 @@ public abstract class Image implements V return imageListeners; } + public void clearImageListeners() { + this.imageListeners = new ImageListenerList(); + } + public static Image load(URL location) throws TaskExecutionException { LoadTask loadTask = new LoadTask(location); return loadTask.execute();