[virt-tools-list] [PATCH virt-viewer 03/25] spice: disconnect signal handlers when either object is destroyed
Marc-André Lureau
mlureau at redhat.com
Mon Jul 23 14:22:00 UTC 2012
----- Mensaje original -----
> On Tue, Jul 17, 2012 at 09:24:45PM +0200, Marc-André Lureau wrote:
> > Use virt_viewer_signal_connect_object(), a copy of telepathy
> > utility function tp_g_signal_connect_object(). This function
> > will take care of removing signal handler if any of emitter or
> > attached object are destroyed.
> >
> > The following patches will have this condition met, since there is
> > no
> > longer 1-1 relation between channel and display. The channels can
> > continue to be around when some of the display are removed.
> > ---
> > src/virt-viewer-display-spice.c | 26 ++++-----
> > src/virt-viewer-util.c | 117
> > +++++++++++++++++++++++++++++++++++++++
> > src/virt-viewer-util.h | 6 ++
> > 3 files changed, 135 insertions(+), 14 deletions(-)
> > diff --git a/src/virt-viewer-util.h b/src/virt-viewer-util.h
> > index 3a40651..38c8078 100644
> > --- a/src/virt-viewer-util.h
> > +++ b/src/virt-viewer-util.h
> > @@ -40,6 +40,12 @@ int virt_viewer_util_extract_host(const char
> > *uristr,
> > char **user,
> > int *port);
> >
> > +gulong virt_viewer_signal_connect_object(gpointer instance,
> > + const gchar
> > *detailed_signal,
> > + GCallback c_handler,
> > + gpointer gobject,
> > + GConnectFlags
> > connect_flags);
> > +
> > #endif
>
> Superficially this looks like it tries todo the same as
> g_signal_connect_object ?
>
> http://developer.gnome.org/gobject/stable/gobject-Signals.html#g-signal-connect-object
>
> Does it avoids the flaws mentioned about that API ?
Yes, see also: http://cgit.freedesktop.org/telepathy/telepathy-glib/tree/telepathy-glib/util.c#n984
And bug https://bugzilla.gnome.org/show_bug.cgi?id=118536
More information about the virt-tools-list
mailing list