[tracker/wip/carlosg/more-bus-fixes: 2/4] libtracker-sparql/bus: Avoid reentrancy on bus batches
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/more-bus-fixes: 2/4] libtracker-sparql/bus: Avoid reentrancy on bus batches
- Date: Sat, 23 Jul 2022 18:42:46 +0000 (UTC)
commit d64097797545484a35e6dfa91dd61a458ecac89f
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Jul 23 19:36:38 2022 +0200
libtracker-sparql/bus: Avoid reentrancy on bus batches
The tracker_batch_execute() call is nowadays implemented through
tracker_batch_execute_async turned into a synchronous operation.
However that results in tracker_batch_execute*() being called
twice and triggering warnings about the batch having been already
executed.
So implement tracker_batch_execute() for bus cursors over the
internal bus connection functions, so that we don't cause
reentrance on the high level API (which is still meant to catch
user misuse of batches).
src/libtracker-sparql/bus/tracker-bus-batch.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-sparql/bus/tracker-bus-batch.c b/src/libtracker-sparql/bus/tracker-bus-batch.c
index b2f144ca3..a9b1e3cf6 100644
--- a/src/libtracker-sparql/bus/tracker-bus-batch.c
+++ b/src/libtracker-sparql/bus/tracker-bus-batch.c
@@ -37,6 +37,11 @@ typedef struct {
G_DEFINE_TYPE (TrackerBusBatch, tracker_bus_batch, TRACKER_TYPE_BATCH)
+static void tracker_bus_batch_execute_async (TrackerBatch *batch,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
static void
tracker_bus_batch_finalize (GObject *object)
{
@@ -97,10 +102,10 @@ tracker_bus_batch_execute (TrackerBatch *batch,
data.loop = g_main_loop_new (context, FALSE);
g_main_context_push_thread_default (context);
- tracker_batch_execute_async (batch,
- cancellable,
- execute_cb,
- &data);
+ tracker_bus_batch_execute_async (batch,
+ cancellable,
+ execute_cb,
+ &data);
g_main_loop_run (data.loop);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]