diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2020-04-25 19:38:56 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2020-04-27 19:10:34 +0200 |
commit | 4ab9041bdaa53c5cf432221c53fdc6bab32bfb35 (patch) | |
tree | 2b8493969a00e67361d7702fad4b5ce319f52415 /src | |
parent | d8e8903546cdd04f8b01ebd28e1682b75a633da1 (diff) | |
download | tracker-4ab9041bdaa53c5cf432221c53fdc6bab32bfb35.tar.gz |
libtracker-data: Fix GValue usage
If we enter the paths where a delete is queued together with other
updates. The GValue being passed was trusted to exist, although it
is implicitly deleted early in value_set_remove_value().
Keep a copy of the GValue and use it to pass it along to
superproperties handling.
Diffstat (limited to 'src')
-rw-r--r-- | src/libtracker-data/tracker-data-update.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c index fd70a07d8..4aa2468d4 100644 --- a/src/libtracker-data/tracker-data-update.c +++ b/src/libtracker-data/tracker-data-update.c @@ -1925,17 +1925,18 @@ cache_delete_resource_type_full (TrackerData *data, old_values = get_old_property_values (data, prop, NULL); for (y = old_values->len - 1; y >= 0 ; y--) { - GValue *old_gvalue; + GValue *old_gvalue, copy = G_VALUE_INIT; old_gvalue = &g_array_index (old_values, GValue, y); + g_value_init (©, G_VALUE_TYPE (old_gvalue)); + g_value_copy (old_gvalue, ©); value_set_remove_value (old_values, old_gvalue); cache_delete_value (data, table_name, field_name, - old_gvalue, multiple_values, + ©, multiple_values, tracker_property_get_fulltext_indexed (prop), tracker_property_get_data_type (prop) == TRACKER_PROPERTY_TYPE_DATETIME); - if (!multiple_values) { TrackerClass **domain_index_classes; @@ -1945,7 +1946,7 @@ cache_delete_resource_type_full (TrackerData *data, cache_delete_value (data, tracker_class_get_name (*domain_index_classes), field_name, - old_gvalue, multiple_values, + ©, multiple_values, tracker_property_get_fulltext_indexed (prop), tracker_property_get_data_type (prop) == TRACKER_PROPERTY_TYPE_DATETIME); } @@ -1953,6 +1954,7 @@ cache_delete_resource_type_full (TrackerData *data, } } + g_value_unset (©); } } |