[gnome-remote-desktop] rdp/rdpgfx: Unref surface serial after looking up surface context



commit 72b75dcd24784e5a673ac27ea1a67e6955a93950
Author: Pascal Nowack <Pascal Nowack gmx de>
Date:   Mon Oct 18 09:41:34 2021 +0200

    rdp/rdpgfx: Unref surface serial after looking up surface context
    
    The surface context of a surface exists until the surface is deleted
    and all references are cleared.
    
    So, when looking up a the surface context to ack a frame, unref the
    serial afterwards and not before, as otherwise gnome-remote-desktop
    would crash since the surface context might already be deleted, due to
    the already been deleted.
    Currently, gnome-remote-desktop is not able to crash with its current
    architecture here, since only one monitor is screencasted and the GFX
    surface currently exists until the end of the remote desktop session.

 src/grd-rdp-graphics-pipeline.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/grd-rdp-graphics-pipeline.c b/src/grd-rdp-graphics-pipeline.c
index dbf3ef6..1d3096e 100644
--- a/src/grd-rdp-graphics-pipeline.c
+++ b/src/grd-rdp-graphics-pipeline.c
@@ -1136,8 +1136,6 @@ handle_frame_ack_event (GrdRdpGraphicsPipeline             *graphics_pipeline,
       uint32_t surface_serial;
 
       surface_serial = GPOINTER_TO_UINT (value);
-      surface_serial_unref (graphics_pipeline, surface_serial);
-
       if (!g_hash_table_lookup_extended (graphics_pipeline->serial_surface_table,
                                          GUINT_TO_POINTER (surface_serial),
                                          NULL, (gpointer *) &surface_context))
@@ -1149,6 +1147,8 @@ handle_frame_ack_event (GrdRdpGraphicsPipeline             *graphics_pipeline,
                                          frame_acknowledge->frameId,
                                          g_get_monotonic_time ());
         }
+
+      surface_serial_unref (graphics_pipeline, surface_serial);
     }
 
   if (frame_acknowledge->queueDepth == SUSPEND_FRAME_ACKNOWLEDGEMENT)


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