[tracker/wip/carlosg/backports-for-3-1: 12/16] libtracker-data: Do not load vtabs if vtab data is missing




commit 24d0b7939a87d4543a60a7a3119ac6593e33d35c
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Apr 22 17:10:49 2021 +0200

    libtracker-data: Do not load vtabs if vtab data is missing
    
    We have one case of direct use of tracker_db_manager_new() in
    "tracker3 export" CLI command to (ab)use it to open databases from
    2.x. This doesn't pass a TrackerDataManager nor requires creating
    the usual 3.x virtual tables.
    
    Avoid this virtual table creation in that case, and subsequent
    crashes when trying to access the NULL data manager from those.
    
    Related: https://bugzilla.redhat.com/show_bug.cgi?id=1951194

 src/libtracker-data/tracker-db-manager.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/libtracker-data/tracker-db-manager.c b/src/libtracker-data/tracker-db-manager.c
index e3044819c..5485ce623 100644
--- a/src/libtracker-data/tracker-db-manager.c
+++ b/src/libtracker-data/tracker-db-manager.c
@@ -776,7 +776,8 @@ tracker_db_manager_create_db_interface (TrackerDBManager  *db_manager,
                                            g_weak_ref_get (&db_manager->iface_data),
                                            g_object_unref);
 
-       tracker_db_interface_init_vtabs (connection, db_manager->vtab_data);
+       if (db_manager->vtab_data)
+               tracker_db_interface_init_vtabs (connection, db_manager->vtab_data);
 
        iface_set_params (connection,
                          readonly,


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