[gtk-vnc] src: check connections errors earlier when processing cursor changes



commit bbeede2e70635a9ed3a5edffaf4c7b0c6ae2187f
Author: Daniel P. Berrangé <dan berrange com>
Date:   Tue Dec 8 13:28:50 2020 +0000

    src: check connections errors earlier when processing cursor changes
    
    Signed-off-by: Daniel P. Berrangé <berrange redhat com>

 src/vncconnection.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/vncconnection.c b/src/vncconnection.c
index 3866ab0..0ba8093 100644
--- a/src/vncconnection.c
+++ b/src/vncconnection.c
@@ -3011,6 +3011,8 @@ static void vnc_connection_rich_cursor(VncConnection *conn, guint16 x, guint16 y
 
         vnc_connection_read(conn, image, imagelen);
         vnc_connection_read(conn, mask, masklen);
+        if (vnc_connection_has_error(conn))
+            return;
 
         vnc_connection_rich_cursor_blt(conn, pixbuf, image, mask,
                                        width * (priv->fmt.bits_per_pixel/8),
@@ -3032,9 +3034,6 @@ static void vnc_connection_rich_cursor(VncConnection *conn, guint16 x, guint16 y
         priv->cursor = vnc_cursor_new(pixbuf, x, y, width, height);
     }
 
-    if (vnc_connection_has_error(conn))
-        return;
-
     sigdata.params.cursor = priv->cursor;
 
     vnc_connection_emit_main_context(conn, VNC_CURSOR_CHANGED, &sigdata);
@@ -3060,6 +3059,8 @@ static void vnc_connection_xcursor(VncConnection *conn, guint16 x, guint16 y, gu
         guint32 fg, bg;
         vnc_connection_read(conn, fgrgb, 3);
         vnc_connection_read(conn, bgrgb, 3);
+        if (vnc_connection_has_error(conn))
+            return;
         fg = (255 << 24) | (fgrgb[0] << 16) | (fgrgb[1] << 8) | fgrgb[2];
         bg = (255 << 24) | (bgrgb[0] << 16) | (bgrgb[1] << 8) | bgrgb[2];
 
@@ -3070,6 +3071,8 @@ static void vnc_connection_xcursor(VncConnection *conn, guint16 x, guint16 y, gu
 
         vnc_connection_read(conn, data, rowlen*height);
         vnc_connection_read(conn, mask, rowlen*height);
+        if (vnc_connection_has_error(conn))
+            return;
         datap = data;
         maskp = mask;
         pixp = (guint32*)pixbuf;
@@ -3097,9 +3100,6 @@ static void vnc_connection_xcursor(VncConnection *conn, guint16 x, guint16 y, gu
         priv->cursor = vnc_cursor_new(pixbuf, x, y, width, height);
     }
 
-    if (vnc_connection_has_error(conn))
-        return;
-
     sigdata.params.cursor = priv->cursor;
 
     vnc_connection_emit_main_context(conn, VNC_CURSOR_CHANGED, &sigdata);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]