diff options
author | Hans de Goede <hdegoede@redhat.com> | 2013-03-07 13:54:16 +0100 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2013-04-09 13:12:07 +0200 |
commit | dc164370b6d68be289f0f41b2a29f7f7c6c345d1 (patch) | |
tree | 7aa0028404952ddf495e8eef7b1611b9c99c76c6 | |
parent | d0b3699903bbc186339e7681c7088e5b624112c4 (diff) |
channel-main: Allow calling file_xfer_close_cb with a NULL object
So that it can used for cleanup before we've a file_stream.
Note this also gets rid of the weird double initialization of the local
stream variable.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r-- | gtk/channel-main.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/gtk/channel-main.c b/gtk/channel-main.c index 3222591..c7ac12d 100644 --- a/gtk/channel-main.c +++ b/gtk/channel-main.c @@ -1562,17 +1562,18 @@ static void file_xfer_close_cb(GObject *object, { GSimpleAsyncResult *res; SpiceFileXferTask *task; - GInputStream *stream = G_INPUT_STREAM(object); GError *error = NULL; - stream = G_INPUT_STREAM(object); task = user_data; - g_input_stream_close_finish(stream, close_res, &error); - if (error) { - /* This error dont need to report to user, just print a log */ - SPICE_DEBUG("close file error: %s", error->message); - g_clear_error(&error); + if (object) { + GInputStream *stream = G_INPUT_STREAM(object); + g_input_stream_close_finish(stream, close_res, &error); + if (error) { + /* This error dont need to report to user, just print a log */ + SPICE_DEBUG("close file error: %s", error->message); + g_clear_error(&error); + } } /* Notify to user that files have been transferred or something error |