mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-10-01 18:50:27 +03:00
SoundControl crash fix
This commit is contained in:
@@ -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;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user