]> source.dussan.org Git - tigervnc.git/commitdiff
VNCServerST: Allow unsetting pixel buffer.
authorMichal Srb <michalsrb@gmail.com>
Fri, 29 Sep 2017 12:45:33 +0000 (14:45 +0200)
committerPierre Ossman <ossman@cendio.se>
Wed, 7 Mar 2018 14:28:43 +0000 (15:28 +0100)
Originally calling VNCServertST::setPixelBuffer(PixelBuffer* pb_) with pb_=0 would do nothing.
With this change pb will be set to 0 and deferred update timer will be stopped.

common/rfb/VNCServerST.cxx

index fc649fa133e71b80954d63b37ee139f2ef76c52a..0008dc416982fcbd78f9ba6d80959f49dc4b7091 100644 (file)
@@ -158,6 +158,7 @@ void VNCServerST::removeSocket(network::Socket* sock) {
         slog.debug("no authenticated clients - stopping desktop");
         desktopStarted = false;
         desktop->stop();
+        stopFrameClock();
       }
 
       if (comparer)
@@ -314,8 +315,11 @@ void VNCServerST::setPixelBuffer(PixelBuffer* pb_, const ScreenSet& layout)
   screenLayout = layout;
 
   if (!pb) {
+    screenLayout = ScreenSet();
+
     if (desktopStarted)
       throw Exception("setPixelBuffer: null PixelBuffer when desktopStarted?");
+
     return;
   }
 
@@ -338,18 +342,10 @@ void VNCServerST::setPixelBuffer(PixelBuffer* pb_, const ScreenSet& layout)
 
 void VNCServerST::setPixelBuffer(PixelBuffer* pb_)
 {
-  ScreenSet layout;
-
-  if (!pb_) {
-    if (desktopStarted)
-      throw Exception("setPixelBuffer: null PixelBuffer when desktopStarted?");
-    return;
-  }
-
-  layout = screenLayout;
+  ScreenSet layout = screenLayout;
 
   // Check that the screen layout is still valid
-  if (!layout.validate(pb_->width(), pb_->height())) {
+  if (pb_ && !layout.validate(pb_->width(), pb_->height())) {
     Rect fbRect;
     ScreenSet::iterator iter, iter_next;