From 92a0bc902ad08ca0667e66c27708374bb156795f Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 16 Mar 2013 19:53:15 +0100 Subject: [PATCH] Send event after source has been updated. --- .../net/pterodactylus/sonitus/data/filter/MultiSourceFilter.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/pterodactylus/sonitus/data/filter/MultiSourceFilter.java b/src/main/java/net/pterodactylus/sonitus/data/filter/MultiSourceFilter.java index a505c92..fb52c9d 100644 --- a/src/main/java/net/pterodactylus/sonitus/data/filter/MultiSourceFilter.java +++ b/src/main/java/net/pterodactylus/sonitus/data/filter/MultiSourceFilter.java @@ -144,10 +144,11 @@ public class MultiSourceFilter implements Filter, ReusableSink { */ public Connection source(Source source) throws IOException { synchronized (syncObject) { - if (this.source != null) { - eventBus.post(new SourceFinishedEvent(this.source)); - } + Source oldSource = this.source; this.source = source; + if (oldSource != null) { + eventBus.post(new SourceFinishedEvent(oldSource)); + } pipedInputStream = new PipedInputStream(); pipedOutputStream = new PipedOutputStream(pipedInputStream); syncObject.notifyAll(); -- 2.7.4