Skip to content

Commit 52a4e76

Browse files
committed
fix(workspaces): avoid useless mutex lock
1 parent 16b856c commit 52a4e76

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/modules/sway/workspaces.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,14 @@ std::string waybar::modules::sway::Workspaces::getIcon(std::string name)
136136

137137
bool waybar::modules::sway::Workspaces::handleScroll(GdkEventScroll *e)
138138
{
139-
std::lock_guard<std::mutex> lock(mutex_);
140139
// Avoid concurrent scroll event
141140
if (scrolling_) {
142141
return false;
143142
}
144143
scrolling_ = true;
145144
int id = -1;
146145
uint16_t idx = 0;
146+
std::lock_guard<std::mutex> lock(mutex_);
147147
for (; idx < workspaces_.size(); idx += 1) {
148148
if (workspaces_[idx]["focused"].asBool()) {
149149
id = workspaces_[idx]["num"].asInt();

0 commit comments

Comments
 (0)