aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp6
1 files changed, 6 insertions, 0 deletions
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 <algorithm>
+#include <mutex>
+
#include <json.h>
extern "C" {
@@ -28,6 +30,8 @@ extern "C" {
}
namespace {
+std::mutex binding_m;
+
struct afb_instance {
std::unique_ptr<wl::display> 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<std::mutex> guard(binding_m);
+
if ((events & EPOLLHUP) != 0) {
logerror("The compositor hung up, dying now.");
delete g_afb_instance;