From 89685c1f1e603d9a45ce0f3407c73e712dd7ad5a Mon Sep 17 00:00:00 2001 From: Marcus Fritzsch Date: Thu, 31 Aug 2017 17:17:42 +0200 Subject: main/binding: do not allow concurrent threads in App Signed-off-by: Marcus Fritzsch --- src/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index a768347..47e3335 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -20,6 +20,8 @@ #include "wayland.hpp" #include +#include + #include extern "C" { @@ -28,6 +30,8 @@ extern "C" { } namespace { +std::mutex binding_m; + struct afb_instance { std::unique_ptr display; wm::App app; @@ -49,6 +53,8 @@ int afb_instance::init() { int display_event_callback(sd_event_source *evs, int /*fd*/, uint32_t events, void * /*data*/) { + std::lock_guard guard(binding_m); + if ((events & EPOLLHUP) != 0) { logerror("The compositor hung up, dying now."); delete g_afb_instance; -- cgit 1.2.3-korg