Commit 091bd510 authored by Sam Thursfield's avatar Sam Thursfield

Merge branch 'wip/carlosg/init-vtab-on-writable-iface' into 'master'

Ensure to initialize vtab_data early enough

See merge request !89
parents 1f72be40 fdd4bcc3
Pipeline #79262 passed with stage
in 2 minutes and 4 seconds
......@@ -3954,7 +3954,6 @@ static void
load_ontologies_gvdb (TrackerDataManager *manager,
GError **error)
{
TrackerOntologies *ontologies;
gchar *filename;
GFile *child;
......@@ -3962,13 +3961,7 @@ load_ontologies_gvdb (TrackerDataManager *manager,
filename = g_file_get_path (child);
g_object_unref (child);
ontologies = tracker_ontologies_load_gvdb (filename, error);
if (ontologies != NULL) {
g_object_unref (manager->ontologies);
manager->ontologies = ontologies;
}
tracker_ontologies_load_gvdb (manager->ontologies, filename, error);
g_free (filename);
}
......@@ -4208,15 +4201,13 @@ tracker_data_manager_initable_init (GInitable *initable,
manager->update_cache_size,
busy_callback, manager, "",
G_OBJECT (manager),
manager->ontologies,
&internal_error);
if (!manager->db_manager) {
g_propagate_error (error, internal_error);
return FALSE;
}
tracker_db_manager_set_vtab_user_data (manager->db_manager,
manager->ontologies);
manager->first_time_index = is_first_time_index;
tracker_data_manager_update_status (manager, "Initializing data manager");
......@@ -4808,9 +4799,6 @@ tracker_data_manager_initable_init (GInitable *initable,
}
}
tracker_db_manager_set_vtab_user_data (manager->db_manager,
manager->ontologies);
skip_ontology_check:
#ifndef DISABLE_JOURNAL
......
......@@ -586,6 +586,7 @@ tracker_db_manager_new (TrackerDBManagerFlags flags,
gpointer busy_user_data,
const gchar *busy_operation,
GObject *iface_data,
gpointer vtab_data,
GError **error)
{
TrackerDBManager *db_manager;
......@@ -605,6 +606,7 @@ tracker_db_manager_new (TrackerDBManagerFlags flags,
}
db_manager = g_new0 (TrackerDBManager, 1);
db_manager->vtab_data = vtab_data;
/* First set defaults for return values */
if (first_time) {
......@@ -1263,10 +1265,3 @@ tracker_db_manager_check_perform_vacuum (TrackerDBManager *db_manager)
iface = tracker_db_manager_get_writable_db_interface (db_manager);
tracker_db_interface_execute_query (iface, NULL, "VACUUM");
}
void
tracker_db_manager_set_vtab_user_data (TrackerDBManager *db_manager,
gpointer user_data)
{
db_manager->vtab_data = user_data;
}
......@@ -55,6 +55,7 @@ TrackerDBManager *tracker_db_manager_new (TrackerDBManagerF
gpointer busy_user_data,
const gchar *busy_operation,
GObject *iface_data,
gpointer vtab_data,
GError **error);
void tracker_db_manager_free (TrackerDBManager *db_manager);
void tracker_db_manager_remove_all (TrackerDBManager *db_manager);
......@@ -95,9 +96,6 @@ void tracker_db_manager_tokenizer_update (TrackerDBManager
void tracker_db_manager_check_perform_vacuum (TrackerDBManager *db_manager);
void tracker_db_manager_set_vtab_user_data (TrackerDBManager *db_manager,
gpointer user_data);
G_END_DECLS
#endif /* __LIBTRACKER_DB_MANAGER_H__ */
......@@ -613,26 +613,25 @@ tracker_ontologies_write_gvdb (TrackerOntologies *ontologies,
return retval;
}
TrackerOntologies *
tracker_ontologies_load_gvdb (const gchar *filename,
GError **error)
gboolean
tracker_ontologies_load_gvdb (TrackerOntologies *ontologies,
const gchar *filename,
GError **error)
{
TrackerOntologies *ontologies;
TrackerOntologiesPrivate *priv;
GvdbTable *gvdb_table;
ontologies = tracker_ontologies_new ();
priv = tracker_ontologies_get_instance_private (ontologies);
priv->gvdb_table = gvdb_table_new (filename, TRUE, error);
if (!priv->gvdb_table) {
g_object_unref (ontologies);
return NULL;
}
gvdb_table = gvdb_table_new (filename, TRUE, error);
if (!gvdb_table)
return FALSE;
priv->gvdb_table = gvdb_table;
priv->gvdb_namespaces_table = gvdb_table_get_table (priv->gvdb_table, "namespaces");
priv->gvdb_classes_table = gvdb_table_get_table (priv->gvdb_table, "classes");
priv->gvdb_properties_table = gvdb_table_get_table (priv->gvdb_table, "properties");
return ontologies;
return TRUE;
}
GVariant *
......
......@@ -93,7 +93,8 @@ void tracker_ontologies_add_id_uri_pair (TrackerOntologies *o
gboolean tracker_ontologies_write_gvdb (TrackerOntologies *ontologies,
const gchar *filename,
GError **error);
TrackerOntologies *tracker_ontologies_load_gvdb (const gchar *filename,
gboolean tracker_ontologies_load_gvdb (TrackerOntologies *ontologies,
const gchar *filename,
GError **error);
GVariant * tracker_ontologies_get_namespace_value_gvdb (TrackerOntologies *ontologies,
const gchar *uri,
......
......@@ -274,6 +274,7 @@ reset_run (void)
NULL,
NULL,
NULL,
NULL,
&error);
if (!db_manager) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment