Explorar o código

Fix bug in ForwardingObservableListener where re-subbing to an object (output) where the child objects (inputs) have been changed fails.

Sam Jaffe %!s(int64=5) %!d(string=hai) anos
pai
achega
d1d8bbd046

+ 1 - 1
pom.xml

@@ -4,7 +4,7 @@
 
   <groupId>org.leumasjaffe</groupId>
   <artifactId>observer</artifactId>
-  <version>0.5.0</version>
+  <version>0.5.1</version>
   <packaging>jar</packaging>
 
   <name>observer</name>

+ 1 - 1
src/main/lombok/org/leumasjaffe/observer/IndirectObservableListener.java

@@ -33,7 +33,7 @@ public class IndirectObservableListener<C, T> {
 	 */
 	public void setObserved( T obs, Observable... extra ) {
 		Objects.requireNonNull( obs );
-		if ( obs == model ) return;
+		if ( obs == model && (extra.length == 0 || extra[0] == obs) ) return;
 		// Make sure that we aren't listening to any of the previous things.
 		// This means that we can re-use objects instead of destroying and re-making a
 		// bunch of high-level GUI objects any time the model changes.