[libsoup] server: do not try to use server io after soup_server_message_finish()
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] server: do not try to use server io after soup_server_message_finish()
- Date: Fri, 12 Aug 2022 12:40:26 +0000 (UTC)
commit 7dff11b52374af868d105bf790b2d9166341cb3a
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Fri Aug 12 14:38:32 2022 +0200
server: do not try to use server io after soup_server_message_finish()
Message finish can destroy the server io.
libsoup/server/http1/soup-server-message-io-http1.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/libsoup/server/http1/soup-server-message-io-http1.c
b/libsoup/server/http1/soup-server-message-io-http1.c
index d783bde2..8d1be9ab 100644
--- a/libsoup/server/http1/soup-server-message-io-http1.c
+++ b/libsoup/server/http1/soup-server-message-io-http1.c
@@ -908,6 +908,7 @@ io_run (SoupServerMessageIOHTTP1 *server_io)
{
SoupServerMessage *msg = server_io->msg_io->msg;
SoupMessageIOData *io = &server_io->msg_io->base;
+ gboolean success;
GError *error = NULL;
g_assert (!server_io->in_io_run);
@@ -920,10 +921,13 @@ io_run (SoupServerMessageIOHTTP1 *server_io)
}
g_object_ref (msg);
- if (io_run_until (server_io,
- SOUP_MESSAGE_IO_STATE_DONE,
- SOUP_MESSAGE_IO_STATE_DONE,
- &error)) {
+ success = io_run_until (server_io,
+ SOUP_MESSAGE_IO_STATE_DONE,
+ SOUP_MESSAGE_IO_STATE_DONE,
+ &error);
+ server_io->in_io_run = FALSE;
+
+ if (success) {
soup_server_message_finish (msg);
} else if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) {
g_clear_error (&error);
@@ -940,8 +944,6 @@ io_run (SoupServerMessageIOHTTP1 *server_io)
}
g_object_unref (msg);
g_clear_error (&error);
-
- server_io->in_io_run = FALSE;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]