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

Dylan Baker dylan at pnwbakers.com
Fri Sep 30 21:17:40 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 1c25f2c..001b23a 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