[tracker/tracker-1.12] libtracker-data: Protect sqlite3_bind*() with interface lock



commit d8a85a1dc6a558e1d4c9288d3504e45a902bffa6
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Jun 23 18:48:06 2017 +0200

    libtracker-data: Protect sqlite3_bind*() with interface lock
    
    There may be multiple cursors/db_statements from the same db interface
    being accessed from multiple threads. This must be under the
    TrackerDBInterface lock in order to prevent threading issues.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1404285

 src/libtracker-data/tracker-db-interface-sqlite.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c 
b/src/libtracker-data/tracker-db-interface-sqlite.c
index 66e6487..4b0994d 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -2589,7 +2589,9 @@ tracker_db_statement_bind_double (TrackerDBStatement *stmt,
 
        g_assert (!stmt->stmt_is_used);
 
+       tracker_db_interface_lock (stmt->db_interface);
        sqlite3_bind_double (stmt->stmt, index + 1, value);
+       tracker_db_interface_unlock (stmt->db_interface);
 }
 
 void
@@ -2601,7 +2603,9 @@ tracker_db_statement_bind_int (TrackerDBStatement *stmt,
 
        g_assert (!stmt->stmt_is_used);
 
+       tracker_db_interface_lock (stmt->db_interface);
        sqlite3_bind_int64 (stmt->stmt, index + 1, value);
+       tracker_db_interface_unlock (stmt->db_interface);
 }
 
 void
@@ -2612,7 +2616,9 @@ tracker_db_statement_bind_null (TrackerDBStatement *stmt,
 
        g_assert (!stmt->stmt_is_used);
 
+       tracker_db_interface_lock (stmt->db_interface);
        sqlite3_bind_null (stmt->stmt, index + 1);
+       tracker_db_interface_unlock (stmt->db_interface);
 }
 
 void
@@ -2624,7 +2630,9 @@ tracker_db_statement_bind_text (TrackerDBStatement *stmt,
 
        g_assert (!stmt->stmt_is_used);
 
+       tracker_db_interface_lock (stmt->db_interface);
        sqlite3_bind_text (stmt->stmt, index + 1, value, -1, SQLITE_TRANSIENT);
+       tracker_db_interface_unlock (stmt->db_interface);
 }
 
 void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]