Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rust-windowing/softbuffer
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 592c49e4876979bc09b8f5002edcb9b345f6c9c5
Choose a base ref
..
head repository: rust-windowing/softbuffer
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1a7af56718437cd2fc9fb07b43aefb563f91e7e3
Choose a head ref
Showing with 5 additions and 7 deletions.
  1. +0 −1 examples/utils/winit_app.rs
  2. +5 −6 examples/winit_multithread.rs
1 change: 0 additions & 1 deletion examples/utils/winit_app.rs
Original file line number Diff line number Diff line change
@@ -116,7 +116,6 @@ where
}

fn suspended(&mut self, _event_loop: &ActiveEventLoop) {
// TODO: Should we run a destruction function for the user?
let surface_state = self.surface_state.take();
debug_assert!(surface_state.is_some());
drop(surface_state);
11 changes: 5 additions & 6 deletions examples/winit_multithread.rs
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ mod ex {
loop {
println!("waiting for render...");
if do_render.recv().is_err() {
// Main thread is dead.
// The surface state returned from init_surface below is destroyed.
break;
}

@@ -82,11 +82,10 @@ mod ex {
Arc::new(Mutex::new(surface))
};

// TODO: This sample will now spawn a new thread every time the surface is
// (re)created. We should instead start it only once, and send an `Arc`ed clone of
// the surface through do_render?

// Spawn a thread to handle rendering.
// Spawn a thread to handle rendering for this specific surface. The channels will
// be closed and the thread will be stopped whenever this surface (the returned
// context below) is dropped, so that it can all be recreated again (on Android)
// when a new surface is created.
let (start_render, do_render) = mpsc::channel();
let (render_done, finish_render) = mpsc::channel();
println!("starting thread...");