mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-24 18:08:15 +00:00
gtk4: Attach main context receiver from the main context's thread
Otherwise it will fail if the sink's state is changed from a different thread. See https://gitlab.freedesktop.org/dabrain34/GstPipelineStudio/-/issues/2
This commit is contained in:
parent
7bb42f3f5e
commit
34f8c4beac
1 changed files with 9 additions and 9 deletions
|
@ -65,22 +65,22 @@ impl PaintableSink {
|
||||||
// created.
|
// created.
|
||||||
let (send, recv) = mpsc::channel();
|
let (send, recv) = mpsc::channel();
|
||||||
context.invoke(glib::clone!(
|
context.invoke(glib::clone!(
|
||||||
@weak self as s =>
|
@weak self as sink =>
|
||||||
move || {
|
move || {
|
||||||
let paintable = Fragile::new(SinkPaintable::new());
|
let paintable = Fragile::new(SinkPaintable::new());
|
||||||
send.send(paintable).expect("Somehow we dropped the receiver");
|
send.send(paintable).expect("Somehow we dropped the receiver");
|
||||||
}
|
|
||||||
));
|
|
||||||
|
|
||||||
let paintable = recv.recv().expect("Somehow we dropped the sender");
|
|
||||||
|
|
||||||
receiver.attach(
|
receiver.attach(
|
||||||
None,
|
None,
|
||||||
glib::clone!(
|
glib::clone!(
|
||||||
@weak self as sink => @default-return glib::Continue(false),
|
@weak sink => @default-return glib::Continue(false),
|
||||||
move |action| sink.do_action(action)
|
move |action| sink.do_action(action)
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
let paintable = recv.recv().expect("Somehow we dropped the sender");
|
||||||
|
|
||||||
**paintable_storage = Some(paintable);
|
**paintable_storage = Some(paintable);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue