[Spice-devel] [PATCH spice-gtk 5/5] session: bind path and read-only to webdav server

Marc-André Lureau mlureau at redhat.com
Mon Feb 23 05:37:20 PST 2015



----- Original Message -----
> On Sat, Feb 21, 2015 at 01:40:16AM +0100, Marc-André Lureau wrote:
> > Keep the server property in sync with the session properties
> > ---
> >  gtk/spice-session.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/gtk/spice-session.c b/gtk/spice-session.c
> > index 63a455d..e785ceb 100644
> > --- a/gtk/spice-session.c
> > +++ b/gtk/spice-session.c
> > @@ -2650,6 +2650,13 @@ PhodavServer*
> > spice_session_get_webdav_server(SpiceSession *session)
> >          goto end;
> >  
> >      priv->webdav = phodav_server_new(shared_dir);
> > +    g_object_bind_property(session,  "share-dir-ro",
> > +                           priv->webdav, "read-only",
> > +                           G_BINDING_SYNC_CREATE|G_BINDING_BIDIRECTIONAL);
> > +    g_object_bind_property(session,  "shared-dir",
> > +                           priv->webdav, "root",
> > +                           G_BINDING_SYNC_CREATE|G_BINDING_BIDIRECTIONAL);
> > +
> 
> ACK, but I believe you'll need something like the phodav patch below
> (this is untested, so even what I describe in the commit log could be
> totally wrong).

There is a bugzilla for phodav, please use it:
https://bugzilla.gnome.org/enter_bug.cgi?product=phodav


thanks

> 
> From 7025eedb519f075bbfd6c8881d23927a99ec7cb9 Mon Sep 17 00:00:00 2001
> From: Christophe Fergeau <cfergeau at redhat.com>
> Date: Mon, 23 Feb 2015 11:21:48 +0100
> Subject: [PATCH] Fix leaks on dynamic updates of PhodavServer::root
> 
> When changing PhodavServer::root to a new value, update_root_handler()
> will get called to make the server handle the new root path. However,
> the old handler for the old path never gets removed, causing
> PhodavServer to leak resources, and to manage both the old and new
> paths.
> ---
>  libphodav/phodav-server.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/libphodav/phodav-server.c b/libphodav/phodav-server.c
> index 820984d..036b811 100644
> --- a/libphodav/phodav-server.c
> +++ b/libphodav/phodav-server.c
> @@ -152,10 +152,29 @@ phodav_server_init (PhodavServer *self)
>  }
>  
>  static void
> +path_handler_remove (PathHandler *handler)
> +{
> +  char *path;
> +
> +  if (handler == NULL)
> +    return;
> +
> +  path = g_file_get_path (handler->file);
> +  if (path == NULL)
> +    return;
> +
> +  soup_server_remove_handler (handler->self->server, path);
> +  g_free(path);
> +  handler->self->root_handler = NULL;
> +}
> +
> +static void
>  update_root_handler (PhodavServer *self)
>  {
>    PathHandler *handler;
>  
> +  path_handler_remove (self->root_handler);
> +
>    if (!self->root || !self->server)
>      return;
>  
> --
> 2.1.0
> 
> 
> >  
> >   end:
> >      g_mutex_unlock(&mutex);
> > --
> > 2.1.0
> > 
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 


More information about the Spice-devel mailing list