mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 15:20:17 +01:00
egl: Use _eglAddAtExitCall to free thread infos and displays.
Thread infos and displays are usually not freed by applications. This commit add atexit calls to free them. Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
This commit is contained in:
parent
435c7ac24d
commit
64e7bb3262
2 changed files with 4 additions and 3 deletions
|
|
@ -4,6 +4,7 @@
|
|||
#include "eglcontext.h"
|
||||
#include "egllog.h"
|
||||
#include "eglmutex.h"
|
||||
#include "eglglobals.h"
|
||||
|
||||
|
||||
/* This should be kept in sync with _eglInitThreadInfo() */
|
||||
|
|
@ -84,7 +85,7 @@ static INLINE EGLBoolean _eglInitTSD(void (*dtor)(_EGLThreadInfo *))
|
|||
return EGL_FALSE;
|
||||
}
|
||||
_egl_FreeTSD = dtor;
|
||||
(void) _eglFiniTSD;
|
||||
_eglAddAtExitCall(_eglFiniTSD);
|
||||
_egl_TSDInitialized = EGL_TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +119,7 @@ static INLINE EGLBoolean _eglInitTSD(void (*dtor)(_EGLThreadInfo *))
|
|||
{
|
||||
if (!_egl_FreeTSD && dtor) {
|
||||
_egl_FreeTSD = dtor;
|
||||
(void) _eglFiniTSD;
|
||||
_eglAddAtExitCall(_eglFiniTSD);
|
||||
}
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ _eglInitDisplay(void)
|
|||
_eglDisplayHash = _eglNewHashTable();
|
||||
_eglSurfaceHash = _eglNewHashTable();
|
||||
|
||||
(void) _eglFiniDisplay;
|
||||
_eglAddAtExitCall(_eglFiniDisplay);
|
||||
}
|
||||
|
||||
_eglUnlockMutex(&_eglDisplayInitMutex);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue