diff --git a/ci/test_browser_submodule.py b/ci/test_browser_submodule.py index 8e58863215..e615b07e15 100644 --- a/ci/test_browser_submodule.py +++ b/ci/test_browser_submodule.py @@ -13,6 +13,8 @@ from __future__ import annotations import subprocess +import shutil +import tempfile import unittest from pathlib import Path @@ -65,6 +67,20 @@ def test_pointer_keeps_the_browser_client_renames(self) -> None: def test_pointer_keeps_the_panel_renames(self) -> None: self._assert_pointer_at_least(WARNING_SHADOWING_FIX_PANEL, "the panel shadowing renames (#17)") + def test_startup_handshake_without_cef(self) -> None: + sub = ROOT / SUBMODULE + if not (sub / ".git").exists(): + self.skipTest("browser submodule is not checked out") + compiler = shutil.which("c++") + if not compiler: + self.skipTest("C++ compiler is not available") + with tempfile.TemporaryDirectory(prefix="obs-browser-startup-") as output: + result = subprocess.run( + ["uv", "run", str(sub / "tests/startup_state.py"), "--compiler", compiler, "--output-dir", output], + cwd=ROOT, capture_output=True, text=True, timeout=60, + ) + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + if __name__ == "__main__": unittest.main() diff --git a/docs/features.md b/docs/features.md index c78989bf3a..a4ee1d7ebf 100644 --- a/docs/features.md +++ b/docs/features.md @@ -1987,6 +1987,11 @@ area. so the shader failed with a syntax error in code the file doesn't contain. *All*, 2026-11-06. Issue [#3768](https://github.com/obs-rust/obs-studio/issues/3768). +- A browser runtime that never finishes starting no longer leaves OBS waiting + forever at quit. A startup warning names the CEF version and explains why + browser sources and docks are unavailable. A slow runtime can still recover. + *Linux*, 2026-11-07. Issue + [#3833](https://github.com/obs-rust/obs-studio/issues/3833). ### Scenes and UI diff --git a/frontend/obs-main.cpp.hpp b/frontend/obs-main.cpp.hpp index e3b201fb68..7606dc16b6 100644 --- a/frontend/obs-main.cpp.hpp +++ b/frontend/obs-main.cpp.hpp @@ -20,6 +20,7 @@ using namespace std; static log_handler_t def_log_handler; +static void (*obs_main_finish_browser_shutdown)() = nullptr; extern string currentLogFile; extern string lastLogFile; @@ -630,6 +631,18 @@ static int run_program(fstream &logFile, int argc, char *argv[]) return 0; } + if (obs_module_t *browser_module = obs_get_module("obs-browser")) { + void *library = obs_get_module_lib(browser_module); + auto prepare = reinterpret_cast(os_dlsym(library, "obs_browser_prepare_shutdown")); + auto finish = reinterpret_cast(os_dlsym(library, "obs_browser_finish_shutdown")); + if (prepare && finish) { + prepare(); + // Libobs deliberately keeps module libraries loaded after + // unload, so this remains callable after application cleanup. + obs_main_finish_browser_shutdown = finish; + } + } + prof.Stop(); if (program.quitRequested()) { @@ -831,6 +844,15 @@ int main(int argc, char *argv[]) QProcess::startDetached(executable, arguments); } + if (obs_main_finish_browser_shutdown) { + // A CEF stuck in initialization cannot safely run static destructors. + // Finish normal Qt, OBS and platform cleanup, and flush the log before + // letting the browser take its fatal quick-exit path, if necessary. + logFile.flush(); + logFile.close(); + obs_main_finish_browser_shutdown(); + } + return ret; } diff --git a/plugins/obs-browser b/plugins/obs-browser index 463e16b468..21d6bba461 160000 --- a/plugins/obs-browser +++ b/plugins/obs-browser @@ -1 +1 @@ -Subproject commit 463e16b468ba607dfea2cc8bfcc1a0204b441ed3 +Subproject commit 21d6bba4617b332ea96db02fa2bc705b023e2a8f