Avoid possible invalid bitwise operations between threads

As m_paintFlags bits are modified by several threads,
we need some atomic bitwise operations to modify it.
This commit is contained in:
David Capello 2018-03-29 00:39:09 -03:00
parent 0fe5edb7fe
commit fd696c8813

View File

@ -16,6 +16,7 @@
#include "ui/timer.h"
#include "ui/widget.h"
#include <atomic>
#include <cmath>
// TODO move this to laf::base
@ -79,8 +80,9 @@ namespace app {
// These flags indicate which areas must be redrawed in the
// background thread. Equal to DoneFlag when the surface is
// already painted in the background thread surface.
int m_paintFlags;
// already painted in the background thread surface. This must be
// atomic because we need atomic bitwise operations.
std::atomic<int> m_paintFlags;
private:
app::Color getAlphaBarColor(const int u, const int umax);