module/i3: take lock while updating ‘mode’

This commit is contained in:
Daniel Eklöf 2020-12-08 19:36:18 +01:00
parent d9496152e3
commit 3da796810b
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -474,9 +474,14 @@ handle_mode_event(int type, const struct json_object *json, void *_mod)
}
const char *current_mode = json_object_get_string(change);
mtx_lock(&mod->lock);
{
free(m->mode);
m->mode = strdup(current_mode);
m->dirty = true;
}
mtx_unlock(&mod->lock);
return true;
}