diff --git a/modules/module-pipewire.c b/modules/module-pipewire.c
index 831e4f966bebd6354569b94f883e6f31eeca2bc7..7a58def4ee06cdf7fee4029a0e190e126b96ee58 100644
--- a/modules/module-pipewire.c
+++ b/modules/module-pipewire.c
@@ -26,12 +26,14 @@ struct module_data
 {
   WpModule *module;
   WpRemotePipewire *remote_pipewire;
+  GHashTable *registered_endpoints;
 };
 
 static void
 on_endpoint_created(GObject *initable, GAsyncResult *res, gpointer d)
 {
-  g_autoptr (WpEndpoint) endpoint = NULL;
+  struct module_data *data = d;
+  WpEndpoint *endpoint = NULL;
   guint global_id = 0;
 
   /* Get the endpoint */
@@ -43,8 +45,10 @@ on_endpoint_created(GObject *initable, GAsyncResult *res, gpointer d)
   g_object_get (endpoint, "global-id", &global_id, NULL);
   g_debug ("Created client endpoint for global id %d", global_id);
 
-  /* Register the endpoint */
+  /* Register the endpoint and add it to the table */
   wp_endpoint_register (endpoint);
+  g_hash_table_insert (data->registered_endpoints, GUINT_TO_POINTER(global_id),
+      endpoint);
 }
 
 static void
@@ -89,6 +93,23 @@ on_node_added (WpRemotePipewire *rp, guint id, guint parent_id, gconstpointer p,
       endpoint_props, on_endpoint_created, data);
 }
 
+static void
+on_global_removed (WpRemotePipewire *rp, guint id, gpointer d)
+{
+  struct module_data *data = d;
+  WpEndpoint *endpoint = NULL;
+
+  /* Get the endpoint */
+  endpoint = g_hash_table_lookup (data->registered_endpoints,
+      GUINT_TO_POINTER(id));
+  if (!endpoint)
+    return;
+
+  /* Remove the endpoint from the table and unregister it */
+  g_hash_table_remove (data->registered_endpoints, GUINT_TO_POINTER(id));
+  wp_endpoint_unregister (endpoint);
+}
+
 static void
 module_destroy (gpointer d)
 {
@@ -98,6 +119,10 @@ module_destroy (gpointer d)
   data->module = NULL;
   data->remote_pipewire = NULL;
 
+  /* Destroy the registered endpoints table */
+  g_hash_table_unref(data->registered_endpoints);
+  data->registered_endpoints = NULL;
+
   /* Clean up */
   g_slice_free (struct module_data, data);
 }
@@ -122,12 +147,15 @@ wireplumber__module_init (WpModule * module, WpCore * core, GVariant * args)
   data = g_slice_new0 (struct module_data);
   data->module = module;
   data->remote_pipewire = rp;
+  data->registered_endpoints = g_hash_table_new_full (g_direct_hash,
+      g_direct_equal, NULL, (GDestroyNotify)g_object_unref);
 
   /* Set the module destroy callback */
   wp_module_set_destroy_callback (module, module_destroy, data);
 
   /* Register the global added/removed callbacks */
   g_signal_connect(rp, "global-added::node", (GCallback)on_node_added, data);
+  g_signal_connect(rp, "global-removed", (GCallback)on_global_removed, data);
 
   /* Init remoted endpoint */
   g_object_get (rp, "pw-core", &pw_core, "pw-remote", &pw_remote, NULL);
diff --git a/modules/module-pipewire/simple-endpoint.c b/modules/module-pipewire/simple-endpoint.c
index 6f617d50e70bb143032f89e65cf304147d335517..55c18ce3de090d9ee79ca217bf31259537b171ed 100644
--- a/modules/module-pipewire/simple-endpoint.c
+++ b/modules/module-pipewire/simple-endpoint.c
@@ -116,15 +116,6 @@ static const struct pw_node_proxy_events node_node_proxy_events = {
   .param = node_proxy_param,
 };
 
-static void
-on_proxy_node_destroyed (WpProxy* wp_proxy, WpEndpoint *endpoint)
-{
-  g_return_if_fail(WP_IS_ENDPOINT(endpoint));
-
-  /* Unregister the endpoint */
-  wp_endpoint_unregister(endpoint);
-}
-
 static void
 on_all_ports_done(WpProxy *proxy, gpointer data)
 {
@@ -134,10 +125,6 @@ on_all_ports_done(WpProxy *proxy, gpointer data)
   if (!self->init_task)
     return;
 
-  /* Set destroy handler to unregister endpoint on proxy_node destruction */
-  g_signal_connect (self->proxy_node, "destroyed",
-      G_CALLBACK(on_proxy_node_destroyed), WP_ENDPOINT(self));
-
   /* Finish the creation of the endpoint */
   g_task_return_boolean (self->init_task, TRUE);
   g_clear_object(&self->init_task);
diff --git a/modules/module-pw-alsa-udev.c b/modules/module-pw-alsa-udev.c
index 4aaab88c8b03ed88b453ac3dff109a5d2a8fe989..dd652f3e94744f7c164c0983039acfd51b897e62 100644
--- a/modules/module-pw-alsa-udev.c
+++ b/modules/module-pw-alsa-udev.c
@@ -19,12 +19,14 @@ struct impl
 {
   WpModule *module;
   WpRemotePipewire *remote_pipewire;
+  GHashTable *registered_endpoints;
 };
 
 static void
 on_endpoint_created(GObject *initable, GAsyncResult *res, gpointer d)
 {
-  g_autoptr (WpEndpoint) endpoint = NULL;
+  struct impl *impl = d;
+  WpEndpoint *endpoint = NULL;
   guint global_id = 0;
 
   /* Get the endpoint */
@@ -36,8 +38,10 @@ on_endpoint_created(GObject *initable, GAsyncResult *res, gpointer d)
   g_object_get (endpoint, "global-id", &global_id, NULL);
   g_debug ("Created alsa endpoint for global id %d", global_id);
 
-  /* Register the endpoint */
+  /* Register the endpoint and add it to the table */
   wp_endpoint_register (endpoint);
+  g_hash_table_insert (impl->registered_endpoints, GUINT_TO_POINTER(global_id),
+      endpoint);
 }
 
 static void
@@ -76,6 +80,23 @@ on_node_added(WpRemotePipewire *rp, guint id, guint parent_id, gconstpointer p,
       endpoint_props, on_endpoint_created, impl);
 }
 
+static void
+on_global_removed (WpRemotePipewire *rp, guint id, gpointer d)
+{
+  struct impl *impl = d;
+  WpEndpoint *endpoint = NULL;
+
+  /* Get the endpoint */
+  endpoint = g_hash_table_lookup (impl->registered_endpoints,
+      GUINT_TO_POINTER(id));
+  if (!endpoint)
+    return;
+
+  /* Remove the endpoint from the table and unregister it */
+  g_hash_table_remove (impl->registered_endpoints, GUINT_TO_POINTER(id));
+  wp_endpoint_unregister (endpoint);
+}
+
 static void
 module_destroy (gpointer data)
 {
@@ -85,6 +106,10 @@ module_destroy (gpointer data)
   impl->module = NULL;
   impl->remote_pipewire = NULL;
 
+  /* Destroy the registered endpoints table */
+  g_hash_table_unref(impl->registered_endpoints);
+  impl->registered_endpoints = NULL;
+
   /* Clean up */
   g_slice_free (struct impl, impl);
 }
@@ -107,10 +132,13 @@ wireplumber__module_init (WpModule * module, WpCore * core, GVariant * args)
   impl = g_slice_new0(struct impl);
   impl->module = module;
   impl->remote_pipewire = rp;
+  impl->registered_endpoints = g_hash_table_new_full (g_direct_hash,
+      g_direct_equal, NULL, (GDestroyNotify)g_object_unref);
 
   /* Set destroy callback for impl */
   wp_module_set_destroy_callback (module, module_destroy, impl);
 
-  /* Register the global addded callbacks */
+  /* Register the global addded/removed callbacks */
   g_signal_connect(rp, "global-added::node", (GCallback)on_node_added, impl);
+  g_signal_connect(rp, "global-removed", (GCallback)on_global_removed, impl);
 }
diff --git a/modules/module-pw-audio-softdsp-endpoint.c b/modules/module-pw-audio-softdsp-endpoint.c
index c6f2886dc84c80ad6f5f5a86ffd86fd6131da5d8..e9a93fd2a6747af0ffd4aeef3a28b4668a45500d 100644
--- a/modules/module-pw-audio-softdsp-endpoint.c
+++ b/modules/module-pw-audio-softdsp-endpoint.c
@@ -242,15 +242,6 @@ static const struct pw_node_proxy_events dsp_node_events = {
   .param = dsp_node_event_param,
 };
 
-static void
-on_proxy_node_destroyed (WpProxy* wp_proxy, WpEndpoint *endpoint)
-{
-  g_return_if_fail(WP_IS_ENDPOINT(endpoint));
-
-  /* Unregister the endpoint */
-  wp_endpoint_unregister(endpoint);
-}
-
 static void
 on_proxy_dsp_done(WpProxy *proxy, gpointer data)
 {
@@ -260,10 +251,6 @@ on_proxy_dsp_done(WpProxy *proxy, gpointer data)
   if (!self->init_task)
     return;
 
-  /* Set destroy handler to unregister endpoint on proxy_node destruction */
-  g_signal_connect (self->proxy_node, "destroyed",
-      G_CALLBACK(on_proxy_node_destroyed), WP_ENDPOINT(self));
-
   /* Finish the creation of the endpoint */
   g_task_return_boolean (self->init_task, TRUE);
   g_clear_object(&self->init_task);