mirror of
				https://github.com/rad4day/Waybar.git
				synced 2025-10-28 23:12:29 +01:00 
			
		
		
		
	fix(Window): avoid concurrency
This commit is contained in:
		| @@ -65,7 +65,7 @@ std::thread waybar::modules::MPD::event_listener() { | ||||
|       try { | ||||
|         if (connection_ == nullptr) { | ||||
|           // Retry periodically if no connection | ||||
|           update(); | ||||
|           dp.emit(); | ||||
|           std::this_thread::sleep_for(interval_); | ||||
|         } else { | ||||
|           waitForEvent(); | ||||
|   | ||||
| @@ -25,6 +25,7 @@ void Window::onEvent(const struct Ipc::ipc_response& res) { getTree(); } | ||||
|  | ||||
| void Window::onCmd(const struct Ipc::ipc_response& res) { | ||||
|   try { | ||||
|     std::lock_guard<std::mutex> lock(mutex_); | ||||
|     auto payload = parser_.parse(res.payload); | ||||
|     auto [nb, id, name, app_id] = getFocusedNode(payload); | ||||
|     if (!app_id_.empty()) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Alex
					Alex