[gupnp/gupnp-1.0] service-proxy: unconditionally remove server handler in dispose



commit 445813e8fb8052e464eeb9d51a576aead5b1513c
Author: Sven Neumann <neumann teufel de>
Date:   Thu Jan 19 13:12:01 2017 +0100

    service-proxy: unconditionally remove server handler in dispose
    
    The handler installed on the SoupServer owned by the GUPnPContext
    needs to be removed when the GUPnPServiceProxy is disposed. This
    happens in the unsubscribe method, but this method is only called
    unconditionally. If a subscription request is in progress, then
    the proxy is not subscribed, but it has already installed a
    handler. So make sure that this handler is removed under all
    circumstances.
    
    Signed-off-by: Sven Neumann <neumann teufel de>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777491

 libgupnp/gupnp-service-proxy.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/libgupnp/gupnp-service-proxy.c b/libgupnp/gupnp-service-proxy.c
index 8e7157c..363c8c9 100644
--- a/libgupnp/gupnp-service-proxy.c
+++ b/libgupnp/gupnp-service-proxy.c
@@ -289,6 +289,16 @@ gupnp_service_proxy_dispose (GObject *object)
                 proxy->priv->subscribed = FALSE;
         }
 
+        context = gupnp_service_info_get_context (GUPNP_SERVICE_INFO (proxy));
+
+        /* Remove server handler */
+        if (context) {
+            SoupServer *server;
+
+            server = gupnp_context_get_server (context);
+            soup_server_remove_handler (server, proxy->priv->path);
+        }
+
         /* Cancel pending actions */
         while (proxy->priv->pending_actions) {
                 GUPnPServiceProxyAction *action;
@@ -302,7 +312,6 @@ gupnp_service_proxy_dispose (GObject *object)
         }
 
         /* Cancel pending messages */
-        context = gupnp_service_info_get_context (GUPNP_SERVICE_INFO (proxy));
         if (context)
                 session = gupnp_context_get_session (context);
         else


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]