[tracker/wip/carlosg/serialize-api: 33/36] libtracker-data: Add missing locking to cursor API
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/serialize-api: 33/36] libtracker-data: Add missing locking to cursor API
- Date: Fri, 4 Feb 2022 18:24:10 +0000 (UTC)
commit a23eb5550a551ffdecee94fc279b615fb4c4feba
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Feb 2 02:17:57 2022 +0100
libtracker-data: Add missing locking to cursor API
This is using a sqlite3_stmt without locking the DB interface, which
is not usually a good idea.
src/libtracker-data/tracker-db-interface-sqlite.c | 7 +++++++
1 file changed, 7 insertions(+)
---
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c
b/src/libtracker-data/tracker-db-interface-sqlite.c
index d7847e779..a0153c5c9 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -3461,13 +3461,20 @@ db_cursor_iter_next (TrackerDBCursor *cursor,
guint
tracker_db_cursor_get_n_columns (TrackerDBCursor *cursor)
{
+ TrackerDBInterface *iface;
guint n_columns;
+ iface = cursor->ref_stmt->db_interface;
+
+ tracker_db_interface_lock (iface);
+
if (cursor->n_columns == 0)
n_columns = sqlite3_column_count (cursor->stmt);
else
n_columns = cursor->n_columns;
+ tracker_db_interface_unlock (iface);
+
return n_columns;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]