[Piglit] [PATCH 7/15] util: guard against double context destruction

Dylan Baker dylan at pnwbakers.com
Fri Sep 9 19:18:45 UTC 2016


From: Marek Olšák <marek.olsak at amd.com>

this no longer crashes:
- create context (calls atexit)
- teardown context
- create context 2 (calls atexit)
- exit()
---
 tests/util/piglit-framework-gl.c | 4 ++++
 1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/tests/util/piglit-framework-gl.c b/tests/util/piglit-framework-gl.c
index 9748ddf..1e03c73 100644
--- a/tests/util/piglit-framework-gl.c
+++ b/tests/util/piglit-framework-gl.c
@@ -177,8 +177,12 @@ piglit_gl_process_args(int *argc, char *argv[],
 static void
 destroy(void)
 {
+	if (!gl_fw)
+		return;
+
 	if (gl_fw->destroy)
 		gl_fw->destroy(gl_fw);
+	gl_fw = NULL;
 }
 
 void
-- 
git-series 0.8.10


More information about the Piglit mailing list