Module Name: xsrc
Committed By: riastradh
Date: Wed Jul 9 20:14:17 UTC 2014
Modified Files:
xsrc/external/mit/MesaLib/dist/src/glsl: ralloc.c
xsrc/external/mit/MesaLib/dist/src/mesa/main: context.c
Log Message:
Use __attribute__((__destructor__)), not atexit, in shared objects.
To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 xsrc/external/mit/MesaLib/dist/src/glsl/ralloc.c
cvs rdiff -u -r1.1.1.6 -r1.2 \
xsrc/external/mit/MesaLib/dist/src/mesa/main/context.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: xsrc/external/mit/MesaLib/dist/src/glsl/ralloc.c
diff -u xsrc/external/mit/MesaLib/dist/src/glsl/ralloc.c:1.1.1.1 xsrc/external/mit/MesaLib/dist/src/glsl/ralloc.c:1.2
--- xsrc/external/mit/MesaLib/dist/src/glsl/ralloc.c:1.1.1.1 Wed Jul 9 19:38:35 2014
+++ xsrc/external/mit/MesaLib/dist/src/glsl/ralloc.c Wed Jul 9 20:14:16 2014
@@ -272,7 +272,7 @@ ralloc_parent(const void *ptr)
static void *autofree_context = NULL;
-static void
+static void __attribute__((__destructor__))
autofree(void)
{
ralloc_free(autofree_context);
@@ -283,7 +283,6 @@ ralloc_autofree_context(void)
{
if (unlikely(autofree_context == NULL)) {
autofree_context = ralloc_context(NULL);
- atexit(autofree);
}
return autofree_context;
}
Index: xsrc/external/mit/MesaLib/dist/src/mesa/main/context.c
diff -u xsrc/external/mit/MesaLib/dist/src/mesa/main/context.c:1.1.1.6 xsrc/external/mit/MesaLib/dist/src/mesa/main/context.c:1.2
--- xsrc/external/mit/MesaLib/dist/src/mesa/main/context.c:1.1.1.6 Wed Jul 9 19:38:38 2014
+++ xsrc/external/mit/MesaLib/dist/src/mesa/main/context.c Wed Jul 9 20:14:17 2014
@@ -383,10 +383,10 @@ _glthread_DECLARE_STATIC_MUTEX(OneTimeLo
*
* \sa _math_init().
*/
+static GLbitfield api_init_mask = 0x0;
static void
one_time_init( struct gl_context *ctx )
{
- static GLbitfield api_init_mask = 0x0;
_glthread_LOCK_MUTEX(OneTimeLock);
@@ -441,14 +441,16 @@ one_time_init( struct gl_context *ctx )
_glthread_UNLOCK_MUTEX(OneTimeLock);
- /* Hopefully atexit() is widely available. If not, we may need some
- * #ifdef tests here.
- */
- atexit(_mesa_destroy_shader_compiler);
-
dummy_enum_func();
}
+static void __attribute__((__destructor__))
+one_time_fini(void)
+{
+ if (api_init_mask)
+ _mesa_destroy_shader_compiler();
+}
+
/**
* Initialize fields of gl_current_attrib (aka ctx->Current.*)