From 5ada214c51e0300f9a7ed356ef3d2b54b6f3ffd7 Mon Sep 17 00:00:00 2001 From: Abdulrahman Al Zeidi Date: Mon, 7 Nov 2022 09:27:24 +0000 Subject: [PATCH] Fix static object destructors being called on gpu selection with X11 (cherry picked from commit 5860f81c18a2de8b3f38d5a58946939b5cc81425) --- platform/x11/detect_prime.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/platform/x11/detect_prime.cpp b/platform/x11/detect_prime.cpp index f68a1317d8c..b8e43917c9c 100644 --- a/platform/x11/detect_prime.cpp +++ b/platform/x11/detect_prime.cpp @@ -203,7 +203,10 @@ int detect_prime() { print_verbose("Couldn't write vendor/renderer string."); } close(fdset[1]); - exit(0); + + // The function quick_exit() is used because exit() will call destructors on static objects copied by fork(). + // These objects will be freed anyway when the process finishes execution. + quick_exit(0); } }