aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--c/data.cpp1
-rw-r--r--c/main.cpp6
-rw-r--r--c/util.h9
3 files changed, 11 insertions, 5 deletions
diff --git a/c/data.cpp b/c/data.cpp
index b717c4e..7df8bda 100644
--- a/c/data.cpp
+++ b/c/data.cpp
@@ -128,6 +128,7 @@ void WaitFor(void (*f)(unsigned char*))
static auto procThread = [](void (*f)(unsigned char*)) noexcept -> void
{
+ SET_TERMINATE;
while (!(sig & READY))
Sleep(100);
sig = 0;
diff --git a/c/main.cpp b/c/main.cpp
index 7608f05..2af8030 100644
--- a/c/main.cpp
+++ b/c/main.cpp
@@ -25,11 +25,7 @@
* need be. */
/* Exit gracefully on uncaught exception. */
-static auto _ = std::set_terminate([]() noexcept
-{
- ShowException(L"Episode Browser was terminated due to an error: %s", L"Fatal Error", MB_ICONERROR);
- _Exit(1);
-});
+static auto _ = SET_TERMINATE;
/* Looked-up constants. */
int g_dpi = 96;
diff --git a/c/util.h b/c/util.h
index 729e64d..0d8a835 100644
--- a/c/util.h
+++ b/c/util.h
@@ -10,6 +10,15 @@
#define CONCAT(a, b) CONCAT_IMPL(a, b)
#define _ CONCAT(unused_, __LINE__)
+#define SET_TERMINATE \
+ std::set_terminate([]() noexcept \
+ { \
+ ShowException( \
+ L"Episode Browser was terminated due to an error: %s", \
+ L"Fatal Error", MB_ICONERROR); \
+ _Exit(1); \
+ })
+
template <typename F>
struct Finally
{