KASM-5456 null channel bugfix (#94)

* KASM-5456 fix null channel potential

* remove debugging line

---------

Co-authored-by: mattmcclaskey <matt@kasmweb.com>
This commit is contained in:
Matt McClaskey 2024-02-01 09:53:43 -05:00 committed by GitHub
parent 4c6127b47b
commit 7919f6c750
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 6 deletions

View File

@ -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 });
}
}
}

View File

@ -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.");