Explorar o código

fixed release channel while sync

ncannasse %!s(int64=7) %!d(string=hai) anos
pai
achega
3eb1386331
Modificáronse 1 ficheiros con 10 adicións e 0 borrados
  1. 10 0
      hxd/snd/Manager.hx

+ 10 - 0
hxd/snd/Manager.hx

@@ -203,6 +203,10 @@ class Manager {
 				c.position -= c.duration;
 				c.onEnd();
 
+				// if we have released the next channel, let's stop here
+				if( next != null && next.manager == null )
+					next = null;
+
 				if (c.queue.length > 0) {
 					c.sound = c.queue.shift();
 					c.duration = c.sound.getData().duration;
@@ -211,6 +215,7 @@ class Manager {
 					break;
 				}
 			}
+
 			c = next;
 		}
 	}
@@ -660,6 +665,11 @@ class Manager {
 	}
 
 	function releaseChannel(c : Channel) {
+
+		// was already released
+		if( c.manager == null )
+			return;
+
 		if (channels == c) {
 			channels = c.next;
 		} else {