Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
We need to check the length of the image data to avoid errors.
This was originally fixed in #41492 but regressed in the refactor.
  • Loading branch information
zmb3 committed Sep 21, 2024
1 parent 1048539 commit 2ad4f21
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export default function useDesktopSession() {
}));
}
const bmpFrame = bmpBuffer[i];
if (ctx) {
if (ctx && bmpFrame.image_data.data.length != 0) {
ctx.putImageData(bmpFrame.image_data, bmpFrame.left, bmpFrame.top);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ function TdpClientCanvas(props: Props) {
} = props;

useEffect(() => {
// Empty dependency array ensures this runs only once after initial render.
// This code will run after the component has been mounted and the canvasRef has been assigned.
const canvas = canvasRef.current;
if (canvas) {
// Make the canvas a focusable keyboard listener
Expand Down Expand Up @@ -66,6 +64,7 @@ function TdpClientCanvas(props: Props) {
canvas.addEventListener('focusout', onFocusOut);

return () => {
console.log('!!!!canvas cleaning up!!!!!');
window.removeEventListener('resize', windowOnResize);
canvas.removeEventListener('mousemove', onMouseMove);
canvas.removeEventListener('contextmenu', onContextMenu);
Expand Down
4 changes: 2 additions & 2 deletions web/packages/teleport/src/lib/tdp/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ export default class Client extends EventEmitterWebAuthnSender {
this.codec.decodeRdpConnectionActivated(buffer);
const spec = { width: screenWidth, height: screenHeight };
this.logger.info(
`screen spec received from server ${spec.width} x ${spec.height}`
`received screen size from server (${spec.width} x ${spec.height})`
);

this.initFastPathProcessor(ioChannelId, userChannelId, {
Expand Down Expand Up @@ -625,7 +625,7 @@ export default class Client extends EventEmitterWebAuthnSender {

sendClientScreenSpec(spec: ClientScreenSpec) {
this.logger.info(
`requesting screen spec from client ${spec.width} x ${spec.height}`
`sending screen size to server (${spec.width}x${spec.height})`
);
this.send(this.codec.encodeClientScreenSpec(spec));
}
Expand Down

0 comments on commit 2ad4f21

Please sign in to comment.