Do not crash when a monitor is removed

This commit is contained in:
Jef Steelant
2022-11-09 09:34:19 +01:00
parent 8be5bab8ad
commit 8f4f67f69f
6 changed files with 62 additions and 16 deletions

View File

@ -25,7 +25,13 @@ Language::Language(const std::string& id, const Bar& bar, const Json::Value& con
AButton::update();
// register for hyprland ipc
gIPC->registerForIPC("activelayout", [&](const std::string& ev) { this->onEvent(ev); });
gIPC->registerForIPC("activelayout", this);
}
Language::~Language() {
gIPC->unregisterForIPC(this);
// wait for possible event handler to finish
std::lock_guard<std::mutex> lg(mutex_);
}
auto Language::update() -> void {