Skip to content

Commit

Permalink
Include mutext on Hide::onEvent
Browse files Browse the repository at this point in the history
This doesn't solve the issue, but it crashes less often...
  • Loading branch information
somini committed Sep 21, 2020
1 parent 551973a commit 2253f3e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/modules/sway/hide.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <fmt/format.h>
#include <tuple>
#include <mutex>
#include "ALabel.hpp"
#include "bar.hpp"
#include "client.hpp"
Expand Down Expand Up @@ -29,6 +30,7 @@ class Hide : public ALabel, public sigc::trackable {
util::JsonParser parser_;

util::SleeperThread thread_;
std::mutex mutex_;
Ipc ipc_;
};

Expand Down
1 change: 1 addition & 0 deletions src/modules/sway/hide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Hide::Hide(const std::string& id, const Bar& bar, const Json::Value& config)

void Hide::onEvent(const struct Ipc::ipc_response& res) {
auto payload = parser_.parse(res.payload);
std::lock_guard<std::mutex> lock(mutex_);
if (payload.isMember("mode")) {
// barconfig_update: get mode
current_mode_ = payload["mode"].asString();
Expand Down

0 comments on commit 2253f3e

Please sign in to comment.