summaryrefslogtreecommitdiffstats
path: root/vncviewer/PlatformPixelBuffer.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2015-11-13 14:09:27 +0100
committerPierre Ossman <ossman@cendio.se>2015-11-27 11:13:31 +0100
commit0b5a06b8cab3718e09529f30301108a6ede0a922 (patch)
treee892c2278e81a20fa0d2be757d64d404939901f4 /vncviewer/PlatformPixelBuffer.cxx
parent7b63a7cef5824cb1d0475855e179d54f631f3e7d (diff)
downloadtigervnc-0b5a06b8cab3718e09529f30301108a6ede0a922.tar.gz
tigervnc-0b5a06b8cab3718e09529f30301108a6ede0a922.zip
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.
Diffstat (limited to 'vncviewer/PlatformPixelBuffer.cxx')
-rw-r--r--vncviewer/PlatformPixelBuffer.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/vncviewer/PlatformPixelBuffer.cxx b/vncviewer/PlatformPixelBuffer.cxx
index 5bd50d2c..522bad3f 100644
--- a/vncviewer/PlatformPixelBuffer.cxx
+++ b/vncviewer/PlatformPixelBuffer.cxx
@@ -28,15 +28,19 @@ PlatformPixelBuffer::PlatformPixelBuffer(const rfb::PixelFormat& pf,
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;
}