[tracker/wip/passive-extraction: 8/12] tracker-extract: Do not add statistics data if no module handled the file
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/passive-extraction: 8/12] tracker-extract: Do not add statistics data if no module handled the file
- Date: Tue, 7 Jan 2014 22:47:27 +0000 (UTC)
commit 24fb0937288714b98a5308c0eee5394ddc90209d
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 58de1b1..aca147f 100644
--- a/src/tracker-extract/tracker-extract.c
+++ b/src/tracker-extract/tracker-extract.c
@@ -255,20 +255,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]