mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 17:41:05 +00:00
examples: glupload: Fix compilation with Rust < 1.72 on Windows
The event proxy on Windows is only `Sync` if the contained `Sender` is, but until Rust 1.72 it was not. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1506>
This commit is contained in:
parent
30b90673f5
commit
1501f9b944
1 changed files with 5 additions and 2 deletions
|
@ -11,6 +11,7 @@ use std::{
|
||||||
mem,
|
mem,
|
||||||
num::NonZeroU32,
|
num::NonZeroU32,
|
||||||
ptr,
|
ptr,
|
||||||
|
sync::Mutex,
|
||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
|
@ -477,7 +478,9 @@ impl App {
|
||||||
.context("Couldn't wrap GL context")?;
|
.context("Couldn't wrap GL context")?;
|
||||||
|
|
||||||
let gl_context = shared_context.clone();
|
let gl_context = shared_context.clone();
|
||||||
let event_proxy = event_loop.create_proxy();
|
// FIXME: Once MSRV is 1.72 the Mutex is not necessary anymore because
|
||||||
|
// std::sync::mpsc::Sender is Sync by itself
|
||||||
|
let event_proxy = Mutex::new(event_loop.create_proxy());
|
||||||
|
|
||||||
#[allow(clippy::single_match)]
|
#[allow(clippy::single_match)]
|
||||||
bus.set_sync_handler(move |_, msg| {
|
bus.set_sync_handler(move |_, msg| {
|
||||||
|
@ -510,7 +513,7 @@ impl App {
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(e) = event_proxy.send_event(Message::BusEvent) {
|
if let Err(e) = event_proxy.lock().unwrap().send_event(Message::BusEvent) {
|
||||||
eprintln!("Failed to send BusEvent to event proxy: {e}")
|
eprintln!("Failed to send BusEvent to event proxy: {e}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue