diff options
author | Carlos Soriano <csoriano@gnome.org> | 2016-02-02 16:05:21 +0100 |
---|---|---|
committer | Carlos Soriano <csoriano@gnome.org> | 2016-02-03 16:33:55 +0100 |
commit | c12ffc6e80ff772157b5f6777991b140de7d3928 (patch) | |
tree | a9e6e918d6ea244b5fcddfde1da3076550716fc6 /libnautilus-private/nautilus-query.c | |
parent | 543771728fb2a45feffd6f53235e4c4eaac87782 (diff) | |
download | nautilus-c12ffc6e80ff772157b5f6777991b140de7d3928.tar.gz |
query: make date range retrieval thread safe
We are accessing it from multiple threads of the search, so we need
to make sure we don't free it in the middle.
Diffstat (limited to 'libnautilus-private/nautilus-query.c')
-rw-r--r-- | libnautilus-private/nautilus-query.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libnautilus-private/nautilus-query.c b/libnautilus-private/nautilus-query.c index 2912847e2..86dbac4fa 100644 --- a/libnautilus-private/nautilus-query.c +++ b/libnautilus-private/nautilus-query.c @@ -506,11 +506,27 @@ nautilus_query_set_search_type (NautilusQuery *query, } } +/** + * nautilus_query_get_date_range: + * @query: a #NautilusQuery + * + * Retrieves the #GptrArray composed of #GDateTime representing the date range. + * This function is thread safe. + * + * Returns: (transfer full): the #GptrArray composed of #GDateTime representing the date range. + */ GPtrArray* nautilus_query_get_date_range (NautilusQuery *query) { + static GMutex mutex; + g_return_val_if_fail (NAUTILUS_IS_QUERY (query), NULL); + g_mutex_lock (&mutex); + if (query->date_range) + g_ptr_array_ref (query->date_range); + g_mutex_unlock (&mutex); + return query->date_range; } |