aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Giessen <charles@lunarg.com>2023-04-14 15:42:31 -0600
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>2023-04-14 17:07:33 -0600
commitdb7475424c5deed3a8d2acf1b5022ad4accf206f (patch)
tree9a5920a65b6377dd19e17abf2c6758576c759a8c
parent8bb9edd13f5027b6676f5229cb4a1822050b1f36 (diff)
downloadusermoji-db7475424c5deed3a8d2acf1b5022ad4accf206f.tar.xz
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.
-rw-r--r--vulkaninfo/vulkaninfo.cpp7
1 files 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();