Skip to content

Commit

Permalink
Anvil: fix LoopHandle leak
Browse files Browse the repository at this point in the history
  • Loading branch information
Paraworker authored and Drakulix committed Nov 18, 2024
1 parent ace2e6a commit 2fa584e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions anvil/src/udev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ pub fn run_udev() {
})
.unwrap();

let handle = event_loop.handle();
event_loop
.handle()
.insert_source(notifier, move |event, &mut (), data| match event {
Expand Down Expand Up @@ -354,7 +353,7 @@ pub fn run_udev() {
warn!("Failed to reset drm surface state: {}", err);
}
}
handle.insert_idle(move |data| data.render(node, None));
data.handle.insert_idle(move |data| data.render(node, None));
}
}
})
Expand Down
7 changes: 3 additions & 4 deletions smallvil/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,9 @@ impl Smallvil {
// Clients will connect to this socket.
let socket_name = listening_socket.socket_name().to_os_string();

let handle = event_loop.handle();
let loop_handle = event_loop.handle();

event_loop
.handle()
loop_handle
.insert_source(listening_socket, move |client_stream, _, state| {
// Inside the callback, you should insert the client into the display.
//
Expand All @@ -127,7 +126,7 @@ impl Smallvil {
.expect("Failed to init the wayland event source.");

// You also need to add the display itself to the event loop, so that client events will be processed by wayland-server.
handle
loop_handle
.insert_source(
Generic::new(display, Interest::READ, Mode::Level),
|_, display, state| {
Expand Down

0 comments on commit 2fa584e

Please sign in to comment.