fix(hyprland/language): apply the CSS class on the main thread
onEvent() runs on the Hyprland IPC listener thread and mutated the label's style context (add/remove class) directly, racing the GTK main thread's drawing and corrupting the heap (double free / corrupted double-linked list). Follow the Submap pattern: onEvent only stores the layout under the mutex and emits the dispatcher; update() swaps the CSS class on the main thread, tracking the previously applied class. Fixes #4665
This commit is contained in:
@@ -30,8 +30,6 @@ class Language : public waybar::ALabel, public EventHandler {
|
||||
std::string short_description;
|
||||
};
|
||||
|
||||
auto removeXkbLayoutCssClass() -> void;
|
||||
auto addXkbLayoutCssClass() -> void;
|
||||
static auto getLayout(const std::string&) -> Layout;
|
||||
|
||||
std::mutex mutex_;
|
||||
@@ -39,6 +37,7 @@ class Language : public waybar::ALabel, public EventHandler {
|
||||
util::JsonParser parser_;
|
||||
|
||||
Layout layout_;
|
||||
std::string prev_short_name_; // applied CSS class; touched only in update() (#4665)
|
||||
|
||||
IPC& m_ipc;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user