aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2024-07-05 14:05:45 +0200
committerPierre Ossman <ossman@cendio.se>2024-07-05 14:05:45 +0200
commitc4075860579ad33011fafee32f34c5d3da71a910 (patch)
treef4cd376ebcd28ab6489250cab603c45808e13796
parentc831c9084afffdf10fa5dda865a6df5d643d83dd (diff)
downloadtigervnc-c4075860579ad33011fafee32f34c5d3da71a910.tar.gz
tigervnc-c4075860579ad33011fafee32f34c5d3da71a910.zip
Be more careful with ComparingUpdateTracker pointer
As of 28c3f12, we might now be running the frame clock even without a framebuffer present. This means we need to be more careful accessing the ComparingUpdateTracker, as it might be NULL.
-rw-r--r--common/rfb/VNCServerST.cxx17
1 files changed, 13 insertions, 4 deletions
diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx
index a8fa1739..705f7df2 100644
--- a/common/rfb/VNCServerST.cxx
+++ b/common/rfb/VNCServerST.cxx
@@ -627,7 +627,8 @@ void VNCServerST::handleTimeout(Timer* t)
// We keep running until we go a full interval without any updates,
// or there are no active clients anymore
- if (comparer->is_empty() || !desktopStarted) {
+ if (!desktopStarted ||
+ ((comparer != nullptr) && comparer->is_empty())) {
// Unless something waits for us to advance the frame count
if (queuedMsc < msc)
return;
@@ -642,7 +643,8 @@ void VNCServerST::handleTimeout(Timer* t)
frameTimer.repeat(timeout);
- if (!comparer->is_empty() && desktopStarted)
+ if (desktopStarted &&
+ ((comparer != nullptr) && !comparer->is_empty()))
writeUpdate();
msc++;
@@ -726,6 +728,7 @@ void VNCServerST::startDesktop()
desktopStarted = true;
// The tracker might have accumulated changes whilst we were
// stopped, so flush those out
+ assert(comparer != nullptr);
if (!comparer->is_empty())
writeUpdate();
// If the frame clock is running, then it will be running slowly,
@@ -772,8 +775,11 @@ void VNCServerST::startFrameClock()
return;
// Anyone actually interested in frames?
- if (comparer->is_empty() && (queuedMsc <= msc))
- return;
+ if (!desktopStarted ||
+ ((comparer != nullptr) && comparer->is_empty())) {
+ if (queuedMsc < msc)
+ return;
+ }
// Run the frame clock very slowly if there are no clients to actually
// send updates to
@@ -820,6 +826,7 @@ void VNCServerST::writeUpdate()
assert(blockCounter == 0);
assert(desktopStarted);
+ assert(comparer != nullptr);
comparer->getUpdateInfo(&ui, pb->getRect());
toCheck = ui.changed.union_(ui.copied);
@@ -863,6 +870,8 @@ Region VNCServerST::getPendingRegion()
if (blockCounter > 0)
return pb->getRect();
+ assert(comparer != nullptr);
+
// Block client from updating if there are pending updates
if (comparer->is_empty())
return Region();