[gnome-photos] tracker-queue: Handle NULL cancellable or destroy_data in data_free



commit 496e153fe0333b3e45eb1fe2d46d8dc2c6aad90e
Author: Debarshi Ray <debarshir gnome org>
Date:   Sat Aug 11 16:45:47 2012 +0200

    tracker-queue: Handle NULL cancellable or destroy_data in data_free

 src/photos-tracker-queue.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/photos-tracker-queue.c b/src/photos-tracker-queue.c
index 3325641..2b9299d 100644
--- a/src/photos-tracker-queue.c
+++ b/src/photos-tracker-queue.c
@@ -61,9 +61,12 @@ struct _PhotosTrackerQueueData
 void
 photos_tracker_queue_data_free (PhotosTrackerQueueData *data)
 {
-  g_object_unref (data->cancellable);
+  g_clear_object (&data->cancellable);
   g_free (data->sparql);
-  (*data->destroy_data) (data->user_data);
+
+  if (data->destroy_data != NULL)
+    (*data->destroy_data) (data->user_data);
+
   g_slice_free (PhotosTrackerQueueData, data);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]