From cc5a63109a671bf32737ac75d45debc9ceff4d53 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 11 Sep 2026 00:56:38 -0400 Subject: [PATCH] SoundControl crash fix --- core/src/mindustry/audio/SoundControl.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/src/mindustry/audio/SoundControl.java b/core/src/mindustry/audio/SoundControl.java index feec28741b..ce2abe6ceb 100644 --- a/core/src/mindustry/audio/SoundControl.java +++ b/core/src/mindustry/audio/SoundControl.java @@ -392,13 +392,15 @@ public class SoundControl{ ambientThread.inputSources.add(source); }else{ launchingAmbientThread = true; - ambientThread = new AudioThread(); - ambientThread.setDaemon(true); + AudioThread thread = new AudioThread(); + thread.setDaemon(true); + ambientThread = thread; //start thread with all the sources that were added during launch Core.app.post(() -> { - if(ambientThread != null){ - if(!ambientThread.isAlive()) ambientThread.start(); + //only start if this is still the active thread, and only ever once + if(ambientThread == thread){ + thread.start(); launchingAmbientThread = false; } });