fix(xwindow): Lock mutexes on update #416
This commit is contained in:
parent
107bdb91e3
commit
384c12a896
@ -13,7 +13,6 @@ namespace modules {
|
||||
void start() {
|
||||
this->m_mainthread = thread([&] {
|
||||
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)->broadcast();
|
||||
});
|
||||
|
@ -96,12 +96,18 @@ namespace modules {
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
broadcast();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the currently active window and query its title
|
||||
*/
|
||||
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;
|
||||
|
||||
if (force) {
|
||||
@ -116,8 +122,6 @@ namespace modules {
|
||||
m_label->reset_tokens();
|
||||
m_label->replace_token("%title%", m_active ? m_active->title() : "");
|
||||
}
|
||||
|
||||
broadcast();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user