The damage tracking region needs to be protected from multiple
threads accessing it at once. The rest should be fine though.
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;
}
#ifndef __PLATFORMPIXELBUFFER_H__
#define __PLATFORMPIXELBUFFER_H__
+#include <os/Mutex.h>
+
#include <rfb/PixelBuffer.h>
#include <rfb/Region.h>
rfb::Rect getDamage(void);
protected:
+ os::Mutex mutex;
rfb::Region damage;
};