Fixed variable synchronization exception caused by the "hyprland/workspace" module receiving create or delete IPC requests too quickly
parent
95b0647c91
commit
1f0ce1a5d9
|
@ -153,17 +153,25 @@ auto Workspaces::register_ipc() -> void {
|
||||||
}
|
}
|
||||||
|
|
||||||
auto Workspaces::update() -> void {
|
auto Workspaces::update() -> void {
|
||||||
|
//remove workspaces that wait to be removed
|
||||||
|
unsigned int current_remove_workspace_num = 0;
|
||||||
for (const std::string &workspace_to_remove : workspaces_to_remove_) {
|
for (const std::string &workspace_to_remove : workspaces_to_remove_) {
|
||||||
remove_workspace(workspace_to_remove);
|
remove_workspace(workspace_to_remove);
|
||||||
|
current_remove_workspace_num++;
|
||||||
|
}
|
||||||
|
for (unsigned int i = 0; i < current_remove_workspace_num; i++) {
|
||||||
|
workspaces_to_remove_.erase(workspaces_to_remove_.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
workspaces_to_remove_.clear();
|
//add workspaces that wait to be created
|
||||||
|
unsigned int current_create_workspace_num = 0;
|
||||||
for (Json::Value const &workspace_to_create : workspaces_to_create_) {
|
for (Json::Value const &workspace_to_create : workspaces_to_create_) {
|
||||||
create_workspace(workspace_to_create);
|
create_workspace(workspace_to_create);
|
||||||
|
current_create_workspace_num++;
|
||||||
|
}
|
||||||
|
for (unsigned int i = 0; i < current_create_workspace_num; i++) {
|
||||||
|
workspaces_to_create_.erase(workspaces_to_create_.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
workspaces_to_create_.clear();
|
|
||||||
|
|
||||||
// get all active workspaces
|
// get all active workspaces
|
||||||
auto monitors = gIPC->getSocket1JsonReply("monitors");
|
auto monitors = gIPC->getSocket1JsonReply("monitors");
|
||||||
|
|
Loading…
Reference in New Issue