From acc3eef2949d0d83e499439f5e3b8907bf7a4ddf Mon Sep 17 00:00:00 2001
From: George Kiagiadakis <george.kiagiadakis@collabora.com>
Date: Tue, 11 Jun 2019 10:57:56 +0300
Subject: [PATCH] softdsp-endpoint: improve destruction sequence

- Set the node proxy to NULL when it is destroyed externally
so that we don't try to destroy it a second time in finalize.
- Don't remove the dsp_listener, as this is already done inside
the node proxy destroy sequence (but keep removing the node
listener to avoid calling node_proxy_destroy() from inside
finalize())
---
 modules/module-pw-audio-softdsp-endpoint.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/modules/module-pw-audio-softdsp-endpoint.c b/modules/module-pw-audio-softdsp-endpoint.c
index d3f351f4..f08fc995 100644
--- a/modules/module-pw-audio-softdsp-endpoint.c
+++ b/modules/module-pw-audio-softdsp-endpoint.c
@@ -224,6 +224,7 @@ node_proxy_destroy(void *data)
 {
   WpPwAudioSoftdspEndpoint *self = data;
 
+  self->node_proxy = NULL;
   wp_endpoint_unregister (WP_ENDPOINT (self));
 }
 
@@ -281,10 +282,8 @@ endpoint_finalize (GObject * object)
   }
 
   /* Remove and destroy the dsp_proxy */
-  if (self->dsp_proxy) {
-    spa_hook_remove (&self->dsp_listener);
+  if (self->dsp_proxy)
     pw_proxy_destroy ((struct pw_proxy *) self->dsp_proxy);
-  }
 
   G_OBJECT_CLASS (endpoint_parent_class)->finalize (object);
 }
-- 
GitLab