Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions ci/test_browser_submodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
from __future__ import annotations

import subprocess
import shutil
import tempfile
import unittest
from pathlib import Path

Expand Down Expand Up @@ -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()
5 changes: 5 additions & 0 deletions docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
22 changes: 22 additions & 0 deletions frontend/obs-main.cpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<void (*)()>(os_dlsym(library, "obs_browser_prepare_shutdown"));
auto finish = reinterpret_cast<void (*)()>(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()) {
Expand Down Expand Up @@ -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;
}

Expand Down
Loading