Skip to content

Commit 346f27d

Browse files
committed
libobs: Disallow overwriting the crash handler
Setting a new crash handler overwrites the existing one. This is not desirable.
1 parent efca325 commit 346f27d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

docs/sphinx/reference-libobs-util-base.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Logging Functions
5555
.. function:: void base_set_crash_handler(void (*handler)(const char *, va_list, void *), void *param)
5656

5757
Sets the current crash handler.
58+
This may only be set once.
5859

5960
---------------------
6061

libobs/util/base.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ void base_set_log_handler(log_handler_t handler, void *param)
8383

8484
void base_set_crash_handler(void (*handler)(const char *, va_list, void *), void *param)
8585
{
86+
if (crash_handler || crash_param) {
87+
blog(LOG_ERROR, "Tried to set a crash handler when one already exists."
88+
"This is unsupported, and will crash in a future version of OBS.");
89+
return;
90+
}
91+
8692
crash_param = param;
8793
crash_handler = handler;
8894
}

0 commit comments

Comments
 (0)