[tracker] libtracker-data: Fix possible double removal of GIOChannel watch sources



commit f2168c0bc8b825855ea6a2525075ee8cff496f9f
Author: Carlos Garnacho <carlos lanedo com>
Date:   Fri Nov 22 17:17:50 2013 +0100

    libtracker-data: Fix possible double removal of GIOChannel watch sources
    
    If some channel watch functions returns FALSE, don't attempt to remove the
    source again on process_context_destroy(). Also, don't leak stdout_channel.
    This fixes critical warnings during make check on the tracker-backup test.

 src/libtracker-data/tracker-data-backup.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-backup.c b/src/libtracker-data/tracker-data-backup.c
index 45c7eeb..91e240e 100644
--- a/src/libtracker-data/tracker-data-backup.c
+++ b/src/libtracker-data/tracker-data-backup.c
@@ -147,7 +147,11 @@ read_line_of_tar_output (GIOChannel  *channel,
                          GIOCondition condition,
                          gpointer     user_data)
 {
+
        if (condition & G_IO_ERR || condition & G_IO_HUP) {
+               ProcessContext *context = user_data;
+
+               context->stdout_watch_id = 0;
                return FALSE;
        }
 
@@ -186,11 +190,13 @@ read_error_of_tar_output (GIOChannel  *channel,
 
                if (status == G_IO_STATUS_EOF ||
                    status == G_IO_STATUS_ERROR) {
+                       context->stderr_watch_id = 0;
                        return FALSE;
                }
        }
 
        if (condition & G_IO_ERR || condition & G_IO_HUP) {
+               context->stderr_watch_id = 0;
                return FALSE;
        }
 
@@ -492,6 +498,7 @@ tracker_data_backup_save (GFile *destination,
        context->data = info;
        context->pid = pid;
        context->stdin_channel = stdin_channel;
+       context->stdout_channel = stdout_channel;
        context->stderr_channel = stderr_channel;
        context->stdout_watch_id = g_io_add_watch (stdout_channel,
                                                   G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,


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