Re: [PATCH spice-server] Initialize earlier GLib type system if necessary

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> On Thu, Mar 30, 2017 at 01:27:45PM +0100, Frediano Ziglio wrote:
> > Before GLib 2.36 you should call g_type_init before attempting
> > any GLib type usage.
> > As constructor function are called before even main we need
> > to call g_type_init much before do_spice_init.
> > 
> > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> > ---
> >  server/red-channel-capabilities.c | 4 ++++
> >  server/reds.c                     | 3 ---
> >  2 files changed, 4 insertions(+), 3 deletions(-)
> > 
> > diff --git a/server/red-channel-capabilities.c
> > b/server/red-channel-capabilities.c
> > index c08cc1a..5a3984a 100644
> > --- a/server/red-channel-capabilities.c
> > +++ b/server/red-channel-capabilities.c
> > @@ -61,6 +61,10 @@ static void
> > red_channel_capabilities_free(RedChannelCapabilities *caps)
> >  
> >  SPICE_CONSTRUCTOR_FUNC(red_channel_capabilities_construct)
> >  {
> > +#if !GLIB_CHECK_VERSION(2,36,0)
> > +    g_type_init();
> > +#endif
> > +
> >      red_channel_capabilities_type =
> >          g_boxed_type_register_static("RedChannelCapabilities",
> >                                       (GBoxedCopyFunc)
> >                                       red_channel_capabilities_dup,
> 
> How does this interact with SPICE_CONSTRUCTOR_FUNC(spice_log_init) in
> spice-common/log.c? Which one is going to get called first? Ideally, the
> logging one, but in this case, should the g_type_init() got there
> instead?

The linker decides, usually it's the order of object/libraries files.
So better to call in both. But I think spice_log_init just need the
thread (and so calls g_thread_init).

> 
> Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>
> 
> if you think this is fine.
> 
> Christophe
> 

Was doing some tests with RHEL6.

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://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]