[Spice-devel] [PATCH spice-gtk] webdav: Do not reuse cancellable

Marc-André Lureau mlureau at redhat.com
Thu Jul 28 17:05:19 UTC 2016


ack

----- Original Message -----
> Create it on SPICE_PORT_EVENT_OPENED
> 
> Reusing the cancellable leads to a crash:
>  #0  0x00007ffff1662940 in g_task_return_error () at /lib64/libgio-2.0.so.0
>  #1  0x00007ffff1662b60 in g_task_return_new_error () at
>  /lib64/libgio-2.0.so.0
>  #2  0x00007ffff57916e0 in read_cancelled (cancellable=<optimized out>,
>  user_data=<optimized out>) at vmcstream.c:182
>  #3  0x00007ffff1391555 in g_closure_invoke () at /lib64/libgobject-2.0.so.0
>  #4  0x00007ffff13a4062 in signal_emit_unlocked_R () at
>  /lib64/libgobject-2.0.so.0
>  #5  0x00007ffff13acf5f in g_signal_emit_valist () at
>  /lib64/libgobject-2.0.so.0
>  #6  0x00007ffff13ad33f in g_signal_emit () at /lib64/libgobject-2.0.so.0
>  #7  0x00007ffff16100d8 in g_cancellable_cancel () at /lib64/libgio-2.0.so.0
>  #8  0x00007ffff5775c01 in port_event (self=0xc7af60, event=1) at
>  channel-webdav.c:512
>  #9  0x00007ffff1391555 in g_closure_invoke () at /lib64/libgobject-2.0.so.0
>  #10 0x00007ffff13a445d in signal_emit_unlocked_R () at
>  /lib64/libgobject-2.0.so.0
>  #11 0x00007ffff13acf5f in g_signal_emit_valist () at
>  /lib64/libgobject-2.0.so.0
>  #12 0x00007ffff577479a in emit_main_context (opaque=0x7fffa5fff8d0) at
>  gio-coroutine.c:200
>  #13 0x00007ffff10b7847 in g_idle_dispatch () at /lib64/libglib-2.0.so.0
>  #14 0x00007ffff10bade2 in g_main_context_dispatch () at
>  /lib64/libglib-2.0.so.0
>  #15 0x00007ffff10bb160 in g_main_context_iterate.isra () at
>  /lib64/libglib-2.0.so.0
>  #16 0x00007ffff10bb20c in g_main_context_iteration () at
>  /lib64/libglib-2.0.so.0
>  #17 0x00007ffff1677d2d in g_application_run () at /lib64/libgio-2.0.so.0
>  #18 0x000000000041031a in main (argc=2, argv=0x7fffffffd928) at
>  remote-viewer-main.c:42
> 
> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=97113
> ---
>  src/channel-webdav.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/channel-webdav.c b/src/channel-webdav.c
> index 307a867..0a2ed72 100644
> --- a/src/channel-webdav.c
> +++ b/src/channel-webdav.c
> @@ -506,7 +506,8 @@ static void port_event(SpiceWebdavChannel *self, gint
> event)
>  
>      CHANNEL_DEBUG(self, "port event:%d", event);
>      if (event == SPICE_PORT_EVENT_OPENED) {
> -        g_cancellable_reset(c->cancellable);
> +        g_clear_object(&c->cancellable);
> +        c->cancellable = g_cancellable_new();
>          start_demux(self);
>      } else {
>          g_cancellable_cancel(c->cancellable);
> @@ -529,7 +530,6 @@ static void spice_webdav_channel_init(SpiceWebdavChannel
> *channel)
>  
>      channel->priv = c;
>      c->stream = spice_vmc_stream_new(SPICE_CHANNEL(channel));
> -    c->cancellable = g_cancellable_new();
>      c->clients = g_hash_table_new_full(g_int64_hash, g_int64_equal,
>                                         NULL, client_remove_unref);
>      c->demux.buf = g_malloc0(MAX_MUX_SIZE);
> --
> 2.9.2
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
> 


More information about the Spice-devel mailing list