[PATCH spice-gtk 12/16] channel-main: Allow calling file_xfer_close_cb with a NULL object

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

 



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@xxxxxxxxxx>
---
 gtk/channel-main.c | 15 ++++++++-------
 1 file 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
-- 
1.8.1.4

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]