fix: use shared state in sdxr_start instead of creating a new BridgeState instance

This commit is contained in:
MayaTheShy
2025-11-08 21:50:35 -05:00
parent 49e6613d94
commit 7fa2e8b727

View File

@@ -320,8 +320,11 @@ pub extern "C" fn sdxr_start(app_id: *const std::os::raw::c_char) -> i32 {
let accent_color = AccentColor::new(dbus_connection.clone());
let context = Context { dbus_connection, accent_color };
let mut state = BridgeState::default();
let mut projector = Projector::create(&state, &context, client.get_root().clone().as_spatial_ref(), "/".into());
// Use the shared_state Arc instead of creating a new BridgeState
let mut projector = {
let state_guard = shared_state.lock().unwrap();
Projector::create(&*state_guard, &context, client.get_root().clone().as_spatial_ref(), "/".into())
};
println!("[bridge] Persistent event loop running");
let event_loop_fut = client.sync_event_loop(|client, flow| {