From 7919f6c75083cee8efe8c2eda54b51edcc066c08 Mon Sep 17 00:00:00 2001 From: Matt McClaskey Date: Thu, 1 Feb 2024 09:53:43 -0500 Subject: [PATCH] KASM-5456 null channel bugfix (#94) * KASM-5456 fix null channel potential * remove debugging line --------- Co-authored-by: mattmcclaskey --- core/display.js | 12 +++++++++--- core/rfb.js | 3 --- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/core/display.js b/core/display.js index 4f1c75fd..25f4dcc8 100644 --- a/core/display.js +++ b/core/display.js @@ -1168,7 +1168,9 @@ export default class Display { default: secondaryScreenRects++; a.img = null; - this._screens[screenLocation.screenIndex].channel.postMessage({ eventType: 'rect', rect: a, screenLocationIndex: sI }); + if (this._screens[screenLocation.screenIndex].channel) { + this._screens[screenLocation.screenIndex].channel.postMessage({ eventType: 'rect', rect: a, screenLocationIndex: sI }); + } } } } @@ -1186,7 +1188,9 @@ export default class Display { } if (secondaryScreenRects > 0 && this._lastTransparentRectId !== this._transparentOverlayRect.hash_id) { for (let sI = 1; sI < this._transparentOverlayRect.screenLocations.length; sI++) { - this._screens[this._transparentOverlayRect.screenLocations[sI].screenIndex].channel.postMessage({ eventType: 'rect', rect: this._transparentOverlayRect, screenLocationIndex: sI }); + if (this._screens[this._transparentOverlayRect.screenLocations[sI].screenIndex].channel) { + this._screens[this._transparentOverlayRect.screenLocations[sI].screenIndex].channel.postMessage({ eventType: 'rect', rect: this._transparentOverlayRect, screenLocationIndex: sI }); + } } } this._lastTransparentRectId = this._transparentOverlayRect.hash_id; @@ -1195,7 +1199,9 @@ export default class Display { if (secondaryScreenRects > 0) { for (let i = 1; i < this.screens.length; i++) { - this._screens[i].channel.postMessage({ eventType: 'frameComplete', frameId: frameId, rectCnt: secondaryScreenRects }); + if (this._screens[i].channel) { + this._screens[i].channel.postMessage({ eventType: 'frameComplete', frameId: frameId, rectCnt: secondaryScreenRects }); + } } } diff --git a/core/rfb.js b/core/rfb.js index 3b597347..7caa707a 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -2031,9 +2031,6 @@ export default class RFB extends EventTargetMixin { _handleMouseOut(ev) { if (ev.toElement !== null && ev.relatedTarget === null && ev.fromElement === null) { //mouse was outside of the window and just came in, this is our chance to do things - Log.Debug("Mouse came into Window"); - Log.Debug(ev); - //Ensure the window was not moved to a different screen with a different pixel ratio if (this._display.screens[0].pixelRatio !== window.devicePixelRatio) { Log.Debug("Window moved to another screen with different pixel ratio, sending resize request.");