diff --git a/obs-browser-plugin.cpp b/obs-browser-plugin.cpp index 6ced773..1d4562e 100644 --- a/obs-browser-plugin.cpp +++ b/obs-browser-plugin.cpp @@ -904,8 +904,14 @@ bool obs_module_load(void) qRegisterMetaType("MessageTask"); #endif - os_event_init(&cef_started_event, OS_EVENT_TYPE_MANUAL); - os_event_init(&cef_initialized_event, OS_EVENT_TYPE_MANUAL); + if (os_event_init(&cef_started_event, OS_EVENT_TYPE_MANUAL) != 0 || + os_event_init(&cef_initialized_event, OS_EVENT_TYPE_MANUAL) != 0) { + blog(LOG_ERROR, "[obs-browser]: Failed to create CEF startup events"); + os_event_destroy(cef_started_event); + cef_started_event = nullptr; + cef_initialized_event = nullptr; + return false; + } #if defined(_WIN32) && CHROME_VERSION_BUILD < 5615 /* CefEnableHighDPISupport doesn't do anything on OS other than Windows. Would also crash macOS at this point as CEF is not directly linked */ diff --git a/obs-browser-source.cpp b/obs-browser-source.cpp index efed81a..2871aec 100644 --- a/obs-browser-source.cpp +++ b/obs-browser-source.cpp @@ -169,7 +169,10 @@ void BrowserSource::ExecuteOnBrowser(BrowserFunc func, bool async) } #endif os_event_t *finishedEvent; - os_event_init(&finishedEvent, OS_EVENT_TYPE_AUTO); + if (os_event_init(&finishedEvent, OS_EVENT_TYPE_AUTO) != 0) { + blog(LOG_ERROR, "[obs-browser]: Failed to create browser task event"); + return; + } bool success = QueueCEFTask([&]() { if (!!cefBrowser) { func(cefBrowser);