[Spice-devel] [spice-gtk v1 4/6] session: gst_deinit() GStreamer if we initialize it

Victor Toso victortoso at redhat.com
Mon Sep 2 16:04:47 UTC 2019


From: Victor Toso <me at victortoso.com>

Let's gst_deinit() if we initialize it for the same rationale pointed out
in 0381e62 "spicy: Add call of gst_deinit at program exit" in
2017-10-20 by Christophe de Dinechin <dinechin at redhat.com>

Signed-off-by: Victor Toso <victortoso at redhat.com>
---
 src/spice-session.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/spice-session.c b/src/spice-session.c
index db40a53..2135348 100644
--- a/src/spice-session.c
+++ b/src/spice-session.c
@@ -123,6 +123,8 @@ struct _SpiceSessionPrivate {
     gchar             *name;
     SpiceImageCompression preferred_compression;
 
+    bool              gst_init_by_spice;
+
     /* associated objects */
     SpiceAudio        *audio_manager;
     SpiceUsbDeviceManager *usb_manager;
@@ -343,6 +345,10 @@ spice_session_dispose(GObject *gobject)
     g_warn_if_fail(s->channels_destroying == 0);
     g_warn_if_fail(s->channels == NULL);
 
+    if (session->priv->gst_init_by_spice) {
+        gst_deinit();
+    }
+
     g_clear_object(&s->audio_manager);
     g_clear_object(&s->usb_manager);
     g_clear_object(&s->proxy);
@@ -2888,5 +2894,7 @@ spice_session_enable_gstreamer(SpiceSession *session)
     if (!gst_init_check(NULL, NULL, &err)) {
         spice_warning("Disabling GStreamer video support: %s", err->message);
         g_clear_error(&err);
+    } else {
+        session->priv->gst_init_by_spice = true;
     }
 }
-- 
2.21.0



More information about the Spice-devel mailing list