From fd696c8813fc760f88efcc6d9a1f32e3f8a0bd3f Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 29 Mar 2018 00:39:09 -0300 Subject: [PATCH] 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. --- src/app/ui/color_selector.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/ui/color_selector.h b/src/app/ui/color_selector.h index 29a8374ca..9d11d621d 100644 --- a/src/app/ui/color_selector.h +++ b/src/app/ui/color_selector.h @@ -16,6 +16,7 @@ #include "ui/timer.h" #include "ui/widget.h" +#include #include // 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 m_paintFlags; private: app::Color getAlphaBarColor(const int u, const int umax);