[phodav: 2/3] server: cleanup properly
- From: Marc-André Lureau <malureau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [phodav: 2/3] server: cleanup properly
- Date: Thu, 9 Jul 2020 06:41:31 +0000 (UTC)
commit cf60585d5cd68275fbfe5e78385dfddb5b8ac5cb
Author: Jakub Janků <jjanku redhat com>
Date: Thu May 28 17:30:39 2020 +0200
server: cleanup properly
Release SoupServer and remove associated handlers.
Signed-off-by: Jakub Janků <jjanku redhat com>
libphodav/phodav-server.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/libphodav/phodav-server.c b/libphodav/phodav-server.c
index 896d191..0a81f5d 100644
--- a/libphodav/phodav-server.c
+++ b/libphodav/phodav-server.c
@@ -156,7 +156,7 @@ update_root_handler (PhodavServer *self)
handler = path_handler_new (self, g_file_new_for_path (self->root));
- soup_server_add_handler (self->server, NULL,
+ soup_server_add_handler (self->server, "/",
server_callback,
handler,
(GDestroyNotify) path_handler_free);
@@ -186,6 +186,12 @@ phodav_server_dispose (GObject *gobject)
{
PhodavServer *self = PHODAV_SERVER (gobject);
+ /* SoupServer could live longer than PhodavServer,
+ * this frees the PhodavHandler passed as user_data */
+ soup_server_remove_handler (self->server, "/");
+ g_signal_handlers_disconnect_by_func (self->server, request_started, self);
+ g_clear_object (&self->server);
+ g_clear_object (&self->cancellable);
g_clear_pointer (&self->root, g_free);
g_clear_pointer (&self->paths, g_hash_table_unref);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]