Explorar o código

Merge pull request #6499 from TrevorDev/multiWorkerFix

basis: only remove event handler if it matches the actionId
David Catuhe %!s(int64=6) %!d(string=hai) anos
pai
achega
1548ae8671
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      src/Misc/basis.ts

+ 2 - 2
src/Misc/basis.ts

@@ -159,8 +159,8 @@ export class BasisTools {
             this._CreateWorkerAsync().then(() => {
             this._CreateWorkerAsync().then(() => {
                 var actionId = this._actionId++;
                 var actionId = this._actionId++;
                 var messageHandler = (msg: any) => {
                 var messageHandler = (msg: any) => {
-                    this._Worker!.removeEventListener("message", messageHandler);
                     if (msg.data.action === "transcode" && msg.data.id === actionId) {
                     if (msg.data.action === "transcode" && msg.data.id === actionId) {
+                        this._Worker!.removeEventListener("message", messageHandler);
                         if (!msg.data.success) {
                         if (!msg.data.success) {
                             rej("Transcode is not supported on this device");
                             rej("Transcode is not supported on this device");
                         }else {
                         }else {
@@ -432,4 +432,4 @@ function workerFunc(): void {
         }
         }
         return dst;
         return dst;
     }
     }
-}
+}