From db7475424c5deed3a8d2acf1b5022ad4accf206f Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Fri, 14 Apr 2023 15:42:31 -0600 Subject: vulkaninfo: Flush before exiting Vulkaninfo does not manually flush the output before exiting, which means that if a crash were to happen during teardown, the stdout buffer may not have finished writing. --- vulkaninfo/vulkaninfo.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vulkaninfo/vulkaninfo.cpp b/vulkaninfo/vulkaninfo.cpp index 7119475b..37c9a684 100644 --- a/vulkaninfo/vulkaninfo.cpp +++ b/vulkaninfo/vulkaninfo.cpp @@ -1139,6 +1139,8 @@ int main(int argc, char **argv) { RunPrinter(*(printer.get()), parse_data, instance, gpus, surfaces); + // Call the printer's destructor before the file handle gets closed + printer.reset(nullptr); #if defined(VULKANINFO_WSI_ENABLED) for (auto &surface_extension : instance.surface_extensions) { AppDestroySurface(instance, surface_extension.surface); @@ -1152,9 +1154,10 @@ int main(int argc, char **argv) { printer->FinishOutput(); } return_code = 1; + + // Call the printer's destructor before the file handle gets closed + printer.reset(nullptr); } - // Call the printer's destructor before the file handle gets closed - printer.reset(nullptr); #ifdef _WIN32 if (parse_data.output_category == OutputCategory::text && !parse_data.print_to_file) wait_for_console_destroy(); -- cgit v1.2.3