From: David ‘Bombe’ Roden Date: Sat, 16 Mar 2013 18:53:15 +0000 (+0100) Subject: Send event after source has been updated. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=92a0bc902ad08ca0667e66c27708374bb156795f;p=sonitus.git Send event after source has been updated. --- 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();