[tracker/wip/passive-extraction: 8/16] tracker-extract: Do not add statistics data if no module handled the file
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/passive-extraction: 8/16] tracker-extract: Do not add statistics data if no module handled the file
- Date: Wed, 15 Jan 2014 17:16:51 +0000 (UTC)
commit eb7ca23c35a2f3094c4e09a26933626581ee7bdf
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Jan 7 22:12:19 2014 +0100
tracker-extract: Do not add statistics data if no module handled the file
This prevents a crash when reporting the statistics later, as there is a
NULL key that is expected to be a GModule.
src/tracker-extract/tracker-extract.c | 28 ++++++++++++++++------------
1 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract.c b/src/tracker-extract/tracker-extract.c
index 3f6c8c4..ece7398 100644
--- a/src/tracker-extract/tracker-extract.c
+++ b/src/tracker-extract/tracker-extract.c
@@ -254,20 +254,24 @@ notify_task_finish (TrackerExtractTask *task,
*/
g_mutex_lock (&priv->task_mutex);
- stats_data = g_hash_table_lookup (priv->statistics_data,
- task->cur_module);
-
- if (!stats_data) {
- stats_data = g_slice_new0 (StatisticsData);
- g_hash_table_insert (priv->statistics_data,
- task->cur_module,
- stats_data);
- }
+ if (task->cur_module) {
+ stats_data = g_hash_table_lookup (priv->statistics_data,
+ task->cur_module);
+
+ if (!stats_data) {
+ stats_data = g_slice_new0 (StatisticsData);
+ g_hash_table_insert (priv->statistics_data,
+ task->cur_module,
+ stats_data);
+ }
- stats_data->extracted_count++;
+ stats_data->extracted_count++;
- if (!success) {
- stats_data->failed_count++;
+ if (!success) {
+ stats_data->failed_count++;
+ }
+ } else {
+ priv->unhandled_count++;
}
priv->running_tasks = g_list_remove (priv->running_tasks, task);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]