fix(xwindow): Lock mutexes on update #416
This commit is contained in:
parent
107bdb91e3
commit
384c12a896
2 changed files with 6 additions and 3 deletions
|
@ -13,7 +13,6 @@ namespace modules {
|
||||||
void start() {
|
void start() {
|
||||||
this->m_mainthread = thread([&] {
|
this->m_mainthread = thread([&] {
|
||||||
this->m_log.trace("%s: Thread id = %i", this->name(), concurrency_util::thread_id(this_thread::get_id()));
|
this->m_log.trace("%s: Thread id = %i", this->name(), concurrency_util::thread_id(this_thread::get_id()));
|
||||||
std::unique_lock<std::mutex> guard(this->m_updatelock);
|
|
||||||
CAST_MOD(Impl)->update();
|
CAST_MOD(Impl)->update();
|
||||||
CAST_MOD(Impl)->broadcast();
|
CAST_MOD(Impl)->broadcast();
|
||||||
});
|
});
|
||||||
|
|
|
@ -96,12 +96,18 @@ namespace modules {
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
broadcast();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the currently active window and query its title
|
* Update the currently active window and query its title
|
||||||
*/
|
*/
|
||||||
void xwindow_module::update(bool force) {
|
void xwindow_module::update(bool force) {
|
||||||
|
std::lock(m_buildlock, m_updatelock);
|
||||||
|
std::lock_guard<std::mutex> guard_a(m_buildlock, std::adopt_lock);
|
||||||
|
std::lock_guard<std::mutex> guard_b(m_updatelock, std::adopt_lock);
|
||||||
|
|
||||||
xcb_window_t win;
|
xcb_window_t win;
|
||||||
|
|
||||||
if (force) {
|
if (force) {
|
||||||
|
@ -116,8 +122,6 @@ namespace modules {
|
||||||
m_label->reset_tokens();
|
m_label->reset_tokens();
|
||||||
m_label->replace_token("%title%", m_active ? m_active->title() : "");
|
m_label->replace_token("%title%", m_active ? m_active->title() : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
broadcast();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue