Protect PlatformPixelBuffer from simultaneous access
The damage tracking region needs to be protected from multiple
threads accessing it at once. The rest should be fine though.
diff --git a/vncviewer/PlatformPixelBuffer.cxx b/vncviewer/PlatformPixelBuffer.cxx
index 5bd50d2..522bad3 100644
--- a/vncviewer/PlatformPixelBuffer.cxx
+++ b/vncviewer/PlatformPixelBuffer.cxx
@@ -28,15 +28,19 @@
void PlatformPixelBuffer::commitBufferRW(const rfb::Rect& r)
{
FullFramePixelBuffer::commitBufferRW(r);
+ mutex.lock();
damage.assign_union(rfb::Region(r));
+ mutex.unlock();
}
rfb::Rect PlatformPixelBuffer::getDamage(void)
{
rfb::Rect r;
+ mutex.lock();
r = damage.get_bounding_rect();
damage.clear();
+ mutex.unlock();
return r;
}