[Spice-commits] server/dcc-send.cpp

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Aug 31 08:50:18 UTC 2020


 server/dcc-send.cpp |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 2899fd91fb17d94c21488c295c15972fa10cac56
Author: Frediano Ziglio <freddy77 at gmail.com>
Date:   Fri Jul 17 16:46:54 2020 +0100

    dcc-send: Fix a regression adding an image item to the pipe
    
    The regression was introduced by
    
        commit 22fc6a48e65b75fbd1dc90c63bdb0df54c6b72e1
    
        red-channel-client: Change GQueue into a std::list
    
        Starts using smart pointers in the queue.
    
    dcc_add_surface_area_image added a new pipe item in front if pos was
    NULL. Before the commit red_add_lossless_drawable_dependencies passed
    a pointer to the last element in the pipe adding the new item on the
    back. The change caused the item to be inserted in front instead of
    back. Restore the insert position.
    This caused in some condition the pipe to grow uncontrollably (like
    using a large notepad window on Windows 7 and moving it around).
    
    Signed-off-by: Frediano Ziglio <freddy77 at gmail.com>

diff --git a/server/dcc-send.cpp b/server/dcc-send.cpp
index 687fd70f..a498c27c 100644
--- a/server/dcc-send.cpp
+++ b/server/dcc-send.cpp
@@ -172,6 +172,11 @@ static bool is_brush_lossy(DisplayChannelClient *dcc, SpiceBrush *brush,
     }
 }
 
+static RedChannelClient::Pipe::iterator get_pipe_tail(RedChannelClient::Pipe& pipe)
+{
+    return pipe.empty() ? pipe.end() : --pipe.end();
+}
+
 static void red_display_add_image_to_pixmap_cache(DisplayChannelClient *dcc,
                                                   SpiceImage *image, SpiceImage *io_image,
                                                   int is_lossy)
@@ -776,7 +781,7 @@ static void red_add_lossless_drawable_dependencies(DisplayChannelClient *dcc,
         // will be executed before the current drawable
         for (i = 0; i < num_deps; i++) {
             dcc_add_surface_area_image(dcc, deps_surfaces_ids[i], deps_areas[i],
-                                       dcc->get_pipe().end(), FALSE);
+                                       get_pipe_tail(dcc->get_pipe()), FALSE);
 
         }
     } else {
@@ -797,7 +802,7 @@ static void red_add_lossless_drawable_dependencies(DisplayChannelClient *dcc,
         }
 
         dcc_add_surface_area_image(dcc, drawable->surface_id, &drawable->bbox,
-                                   dcc->get_pipe().end(), TRUE);
+                                   get_pipe_tail(dcc->get_pipe()), TRUE);
     }
 }
 


More information about the Spice-commits mailing list