On Monday, June 09, 2014 05:50:21 PM Ian Romanick wrote: > On 06/08/2014 03:17 PM, Jordan Justen wrote: > > This will allow us to utilize the early MESA_EXTENSION_OVERRIDE > > parsing at the later extension string initialization step. > > > > Signed-off-by: Jordan Justen <[email protected]> > > --- > > src/mesa/main/extensions.c | 38 ++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 38 insertions(+) > > > > diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c > > index 4e2205d..2617ca9 100644 > > --- a/src/mesa/main/extensions.c > > +++ b/src/mesa/main/extensions.c > > @@ -39,6 +39,7 @@ > > > > struct gl_extensions _mesa_extension_override_enables; > > struct gl_extensions _mesa_extension_override_disables; > > +static char *extra_extensions = NULL; > > > > enum { > > DISABLE = 0, > > @@ -589,6 +590,19 @@ get_extension_override( struct gl_context *ctx ) > > > > > > /** > > + * \brief Free extra_extensions string > > + * > > + * This string is allocated early during the first context creation by > > + * _mesa_one_time_init_extension_overrides. > > + */ > > +static void > > +free_unknown_extensions_strings(void) > > +{ > > + free(extra_extensions); > > +} > > + > > + > > +/** > > * \brief Initialize extension override tables. > > * > > * This should be called one time early during first context initialization. > > @@ -599,8 +613,11 @@ _mesa_one_time_init_extension_overrides(void) > > const char *env_const = _mesa_getenv("MESA_EXTENSION_OVERRIDE"); > > char *env; > > char *ext; > > + int len; > > size_t offset; > > > > + atexit(free_unknown_extensions_strings); > > I have some recollection that we could not use atexit. Maybe it was > incompatible with some applications or something? I can't remember the > details, but I'd swear we had a problem with this in the past...
You're thinking of: https://bugs.freedesktop.org/show_bug.cgi?id=33220 On some platforms, atexit() is called on process exit, not on dlclose(). So, Mesa is completely gone when the callback happens, and crashes occur. We never solved that bug. Linux works fine, so none of us hit this. Some platforms implement support for calling destructors of C++ static objects at library unload time, but didn't fix atexit to do the right thing. A decent article on the subject is here: http://www.gershnik.com/tips/cpp.asp#atexit_dll --Ken
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
