From c4413f1db7d2c600c8608ab4028f703046bdf565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 14 Nov 2023 09:35:38 +0200 Subject: [PATCH] examples: play: Set message bus to flushing before dropping the `Play` reference Otherwise there might be pending messages on the bus that keep a reference to the `Play` instance alive, and neither the bus nor the `Play` are ever going to be freed then. See also https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/489 and https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3107. Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/493 Part-of: --- examples/src/bin/play.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/src/bin/play.rs b/examples/src/bin/play.rs index d18a663f0..15026d55f 100644 --- a/examples/src/bin/play.rs +++ b/examples/src/bin/play.rs @@ -37,6 +37,11 @@ fn main_loop(uri: &str) -> Result<(), Error> { Err(_) => unreachable!(), } } + + // Set the message bus to flushing to ensure that all pending messages are dropped and there + // are no further references to the play instance. + play.message_bus().set_flushing(true); + result.map_err(|e| e.into()) }