Re: [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]

 



On Fri, Mar 29, 2013 at 12:40:24PM +0100, Hans de Goede wrote:
> 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 */

Not added by you, but "This error does not need to be reported to the user"
while you are changing this code.

ACK.

Christophe

Attachment: pgpKNOwQP5Cth.pgp
Description: PGP signature

_______________________________________________
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]