tech-x11 archive

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

Re: CVS commit: xsrc/external/mit/MesaLib/dist/src



On Sun, Jan 24, 2016 at 07:42:35PM +0000, Martin Husemann wrote:
> Module Name:	xsrc
> Committed By:	martin
> Date:		Sun Jan 24 19:42:35 UTC 2016
> 
> Modified Files:
> 	xsrc/external/mit/MesaLib/dist/src/egl/main: eglglobals.c
> 	xsrc/external/mit/MesaLib/dist/src/glsl: glsl_parser_extras.cpp
> 	xsrc/external/mit/MesaLib/dist/src/mesa/main: context.c extensions.c
> 
> Log Message:
> Replace atexit() calls by destructor attributes - this shared library
> is dlopen/dlclose'd !

The patch for one of the files is longer in pkgsrc (MesaLib 11.x though):

--- src/mesa/main/context.c.orig        2015-09-11 17:41:47.000000000 +0000
+++ src/mesa/main/context.c
@@ -350,11 +350,14 @@ mtx_t OneTimeLock = _MTX_INITIALIZER_NP;
  * Calls all the various one-time-fini functions in Mesa
  */

-static void
+static GLbitfield api_init_mask = 0x0;
+static void __attribute__((__destructor__))
 one_time_fini(void)
 {
-   _mesa_destroy_shader_compiler();
-   _mesa_locale_fini();
+   if (api_init_mask) {
+      _mesa_destroy_shader_compiler();
+      _mesa_locale_fini();
+   }
 }

 /**
@@ -369,7 +372,6 @@ one_time_fini(void)
 static void
 one_time_init( struct gl_context *ctx )
 {
-   static GLbitfield api_init_mask = 0x0;

    mtx_lock(&OneTimeLock);

@@ -394,8 +396,6 @@ one_time_init( struct gl_context *ctx )
          _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
       }

-      atexit(one_time_fini);
-
 #if defined(DEBUG) && defined(__DATE__) && defined(__TIME__)
       if (MESA_VERBOSE != 0) {
         _mesa_debug(ctx, "Mesa %s DEBUG build %s %s\n",

 Thomas


Home | Main Index | Thread Index | Old Index