Skip to content

Commit

Permalink
sec_context: Fix None drm_node
Browse files Browse the repository at this point in the history
  • Loading branch information
Drakulix committed Dec 20, 2023
1 parent 2016040 commit d4d5119
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/wayland/handlers/security_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ impl SecurityContextHandler for State {
.map(|data| data.privileged)
.unwrap_or(false);

let new_state = state.new_client_state();

let drm_node = client_data
.as_ref()
.and_then(|data| data.downcast_ref::<ClientState>())
Expand All @@ -41,7 +43,8 @@ impl SecurityContextHandler for State {
.as_ref()
.and_then(|data| data.downcast_ref::<XWaylandClientData>())
.and_then(|data| data.user_data().get::<DrmNode>().cloned())
});
})
.or_else(|| new_state.drm_node.clone());

if let Err(err) = state.common.display_handle.insert_client(
client_stream,
Expand All @@ -51,7 +54,7 @@ impl SecurityContextHandler for State {
&& security_context.sandbox_engine.as_deref()
== Some("com.system76.CosmicPanel"),
drm_node,
..state.new_client_state()
..new_state
}),
) {
warn!(?err, "Error adding wayland client");
Expand Down

0 comments on commit d4d5119

Please sign in to comment.