From 03f007d4cd106ef5ce16a40a2f24147ddb48674c Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 30 Sep 2024 12:04:48 +0200 Subject: [PATCH] Comments (#1651) --- docs/CHANGELOG.txt | 8 +++++++- imgui.cpp | 2 +- imgui.h | 18 ++++++++++-------- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 511901085..db13bc9b1 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -44,9 +44,15 @@ Breaking changes: Other changes: - Error Handling: Enabled/improved error recovery systems. (#1651, #5654) + - Error recovery is provided as a way to facilitate: + - Recovery after a programming error. Native code or scripting language (the later + tends to facilitate iterating on code while running). + - Recovery after running an exception handler or any error processing which may skip code + after an error has been detected. - Error recovery is not perfect nor guaranteed! It is a feature to ease development. + You not are not supposed to rely on it in the course of a normal application run. - Functions that support error recovery are using IM_ASSERT_USER_ERROR() instead of IM_ASSERT(). - - You not are not supposed to rely on it in the course of a normal application run. + - By design, we do not allow error recovery to be 100% silent. One of the options needs to be enabled! - Possible usage: facilitate recovery from errors triggered from a scripting language or after specific exceptions handlers. Surface errors to programmers in less agressive ways. - Always ensure that on programmers seats you have at minimum Asserts or Tooltips enabled diff --git a/imgui.cpp b/imgui.cpp index 5af8a024f..5f0c8281b 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -15240,7 +15240,7 @@ void ImGui::ShowMetricsWindow(bool* p_open) DebugBreakClearData(); // Basic info - Text("Dear ImGui %s", GetVersion()); + Text("Dear ImGui %s (%d)", IMGUI_VERSION, IMGUI_VERSION_NUM); if (g.ContextName[0] != 0) { SameLine(); diff --git a/imgui.h b/imgui.h index 4ab39be3f..59ea4baac 100644 --- a/imgui.h +++ b/imgui.h @@ -2265,18 +2265,20 @@ struct ImGuiIO // Debug options //------------------------------------------------------------------ - // Options to configure how we handle recoverable errors [EXPERIMENTAL] + // Options to configure Error Handling and how we handle recoverable errors [EXPERIMENTAL] + // - Error recovery is provided as a way to facilitate: + // - Recovery after a programming error (native code or scripting language - the later tends to facilitate iterating on code while running). + // - Recovery after running an exception handler or any error processing which may skip code after an error has been detected. // - Error recovery is not perfect nor guaranteed! It is a feature to ease development. + // You not are not supposed to rely on it in the course of a normal application run. // - Functions that support error recovery are using IM_ASSERT_USER_ERROR() instead of IM_ASSERT(). - // - You not are not supposed to rely on it in the course of a normal application run. - // - Possible usage: facilitate recovery from errors triggered from a scripting language or after specific exceptions handlers. - // - Always ensure that on programmers seat you have at minimum Asserts or Tooltips enabled when making direct imgui API calls! + // - By design, we do NOT allow error recovery to be 100% silent. One of the three options needs to be checked! + // - Always ensure that on programmers seats you have at minimum Asserts or Tooltips enabled when making direct imgui API calls! // Otherwise it would severely hinder your ability to catch and correct mistakes! - // Read https://github.com/ocornut/imgui/wiki/Error-Handling for details about typical usage scenarios: + // Read https://github.com/ocornut/imgui/wiki/Error-Handling for details. // - Programmer seats: keep asserts (default), or disable asserts and keep error tooltips (new and nice!) - // - Non-programmer seats: maybe disable asserts, but make sure errors are resurfaced (visible log entries, use callback etc.) - // - Recovery after error from scripting language: record stack sizes before running script, disable assert, trigger breakpoint from ErrorCallback, recover with ErrorRecoveryTryToRecoverState(), restore settings. - // - Recovery after an exception handler: record stack sizes before try {} block, disable assert, set log callback, recover with ErrorRecoveryTryToRecoverState(), restore settings. + // - Non-programmer seats: maybe disable asserts, but make sure errors are resurfaced (tooltips, visible log entries, use callback etc.) + // - Recovery after error/exception: record stack sizes with ErrorRecoveryStoreState(), disable assert, set log callback (to e.g. trigger high-level breakpoint), recover with ErrorRecoveryTryToRecoverState(), restore settings. bool ConfigErrorRecovery; // = true // Enable error recovery support. Some errors won't be detected and lead to direct crashes if recovery is disabled. bool ConfigErrorRecoveryEnableAssert; // = true // Enable asserts on recoverable error. By default call IM_ASSERT() when returning from a failing IM_ASSERT_USER_ERROR() bool ConfigErrorRecoveryEnableDebugLog; // = true // Enable debug log output on recoverable errors.