From 478034b3e384069c6073180d3537cb41bfe90b3c Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Sat, 19 Nov 2022 11:10:37 +0100 Subject: libtracker-sparql: Close descriptors asynchronously in TrackerEndpointDBus The QueryRequest and UpdateRequest internal data structures may be freed from the thread that is handling endpoint requests. Avoid closing descriptors from that thread, this is esp. important with the write FDs since there might be data pending to be written and flushed, so it may be a time consuming operation, or it may even stall if the peer is busy with other things. Closes: https://gitlab.gnome.org/GNOME/tracker/-/issues/386 --- src/libtracker-sparql/tracker-endpoint-dbus.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/libtracker-sparql/tracker-endpoint-dbus.c b/src/libtracker-sparql/tracker-endpoint-dbus.c index 4bc486c76..858448c7f 100644 --- a/src/libtracker-sparql/tracker-endpoint-dbus.c +++ b/src/libtracker-sparql/tracker-endpoint-dbus.c @@ -269,8 +269,9 @@ query_request_free (QueryRequest *request) g_source_unref (request->source); g_object_unref (request->cancellable); - g_output_stream_close (G_OUTPUT_STREAM (request->data_stream), - NULL, NULL); + g_output_stream_close_async (G_OUTPUT_STREAM (request->data_stream), + G_PRIORITY_DEFAULT, + NULL, NULL, NULL); g_object_unref (request->invocation); g_object_unref (request->data_stream); @@ -346,8 +347,9 @@ update_request_read_next (UpdateRequest *request, static void update_request_free (UpdateRequest *request) { - g_input_stream_close (G_INPUT_STREAM (request->input_stream), - NULL, NULL); + g_input_stream_close_async (G_INPUT_STREAM (request->input_stream), + G_PRIORITY_DEFAULT, + NULL, NULL, NULL); g_ptr_array_unref (request->queries); g_object_unref (request->invocation); -- cgit v1.2.1