From 45dc9786f4406529889c6f72fbc9d0efb3f529bc Mon Sep 17 00:00:00 2001
From: George Kiagiadakis <george.kiagiadakis@collabora.com>
Date: Tue, 11 Jun 2019 12:49:11 +0300
Subject: [PATCH] endpoint: ref the endpoint while unregistering

The core may be the last object holding a reference to the endpoint,
so the unregister call may destroy it.
---
 lib/wp/endpoint.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/wp/endpoint.c b/lib/wp/endpoint.c
index 83db6776..c8f6524b 100644
--- a/lib/wp/endpoint.c
+++ b/lib/wp/endpoint.c
@@ -279,8 +279,10 @@ wp_endpoint_unregister (WpEndpoint * self)
     g_info ("WpEndpoint:%p unregistering '%s' (%s)", self, priv->name,
         priv->media_class);
 
+    g_object_ref (self);
     wp_core_remove_global (priv->core, WP_GLOBAL_ENDPOINT, self);
     priv->core = NULL;
+    g_object_unref (self);
   }
 }
 
-- 
GitLab