Permalink
Browse files

Fix property links

* Property link was adding itself as a listener to a specific key but then
on remove trying to remove itself from the global property map update
source. Simple solution, if it's going to listen to a specific key it
needs to remove itself from the key pair listeners.
* PropertyLinkFactory now keeps a map of all links it created and can now
be disposed which is done so automatically by ResourceFrame
  • Loading branch information...
RobertBColton committed Nov 2, 2014
1 parent 35e3f35 commit 8662754845f35486315f178d63c56135cfe9352d
@@ -120,7 +120,7 @@ QuickFind.HIGHLIGHT = Highlight All
AboutBox.TITLE=About LateralGM
AboutBox.ABOUT=<h1 style="white-space: nowrap">Copyright &copy; 2006-2014</h1>\
<p style="white-space: nowrap">Version: 1.8.6.753<br><br>\
<p style="white-space: nowrap">Version: 1.8.6.754<br><br>\
IsmAvatar \
&lt;<a href="mailto:IsmAvatar@gmail.com">IsmAvatar@gmail.com</a>&gt;<br>\
Clam \
@@ -254,6 +254,7 @@ public void dispose()
if (node != null) node.frame = null; // allows a new frame to open
save.removeActionListener(this);
removeAll();
plf.dispose();
}
@Override
@@ -75,6 +75,7 @@ private void update()
}
}
@Override
public void updated(PropertyUpdateEvent<K> e)
{
String t = (String) map.get(key);
@@ -36,6 +36,9 @@
*/
private List<PropertyLinkMapListener<K>> mapListeners = new ArrayList<PropertyLinkMapListener<K>>();
/* Necessary for mass disposing links created by the factory */
private List<PropertyLink<K,?>> mapLinks = new ArrayList<PropertyLink<K,?>>();
public void addLinkMapListener(PropertyLinkMapListener<K> plml) {
mapListeners.add(plml);
}
@@ -68,6 +71,7 @@ public PropertyLinkFactory(PropertyMap<K> m, ExceptionListener el)
*/
l.factory = this;
addLinkMapListener(l);
mapLinks.add(l);
l.setExceptionListener(exceptionListener);
return l;
}
@@ -126,4 +130,13 @@ public PropertyLinkFactory(PropertyMap<K> m, ExceptionListener el)
{
return init(ButtonIncrementLink.make(ab,i,l,map,k));
}
public void dispose()
{
for (PropertyLink<?,?> link : mapLinks) {
link.remove();
}
mapLinks.clear();
mapListeners.clear();
}
}
@@ -35,7 +35,7 @@ public PropertyLink(PropertyMap<K> m, K k)
public void remove()
{
map.updateSource.removeListener(this);
map.getUpdateSource(key).removeListener(this);
factory.removeLinkMapListener(this);
}

0 comments on commit 8662754

Please sign in to comment.