diff --git a/docs/sphinx/reference-libobs-util-base.rst b/docs/sphinx/reference-libobs-util-base.rst index 8485fca8d352fe..ff6a59327be5aa 100644 --- a/docs/sphinx/reference-libobs-util-base.rst +++ b/docs/sphinx/reference-libobs-util-base.rst @@ -55,6 +55,7 @@ Logging Functions .. function:: void base_set_crash_handler(void (*handler)(const char *, va_list, void *), void *param) Sets the current crash handler. + This may only be set once. --------------------- diff --git a/libobs/util/base.c b/libobs/util/base.c index 4e91dcb1dceb04..9a71f1567f1d38 100644 --- a/libobs/util/base.c +++ b/libobs/util/base.c @@ -83,6 +83,15 @@ void base_set_log_handler(log_handler_t handler, void *param) void base_set_crash_handler(void (*handler)(const char *, va_list, void *), void *param) { + static bool non_default_handler_set = false; + + if (non_default_handler_set) { + blog(LOG_ERROR, "Tried to set a crash handler when one already exists. " + "This is unsupported."); + return; + } + + non_default_handler_set = true; crash_param = param; crash_handler = handler; }