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

Christophe Fergeau cfergeau at redhat.com
Tue Apr 9 02:43:18 PDT 2013


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 at redhat.com>
> ---
>  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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20130409/07607d14/attachment-0001.pgp>


More information about the Spice-devel mailing list