diff --git a/lib/wp/endpoint.c b/lib/wp/endpoint.c
index 83db67761d363a8f8951680667189b65d8a79c99..c8f6524b0b56dcf339221095c148789f733ec333 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);
   }
 }