Repository navigation
libobs: Set the module type of obs_add_module_path() paths - #1906
Merged
Merged
Conversation
obs_add_module_path() fills in bin and data but never the type of its struct obs_module_path, so obs_find_modules2() reports whatever was on the stack. The new module_path_type case fills that stack with OBS_MODULE_TYPE_CORE first, adds a path with a disabled module and a module named like a core module, and checks the type reported for both and what libobs's loader does with it: the disabled list must apply, and the core-named module must load as neither core nor legacy. It fails on all three libraries: both modules report type 1 (CORE), the disabled module loads, and the core-named one is marked core. Refs obs-rust#1900
obs_add_module_path() set only bin and data of its struct obs_module_path, so obs_find_modules2() reported an uninitialized type for every module found on those paths. Initialize the whole struct and set the type to OBS_MODULE_TYPE_UNDEFINED. Upstream added the type in 11a8445 ("frontend: Update app module loading behavior", obsproject/obs-studio#13594) and typed only the paths the frontend plugin loaders pass to obs_load_plugins(): PLUGIN for the new locations, LEGACY_PLUGIN for the old ones. The same commit made obs_load_all_modules() and obs_load_all_modules2() no-ops, so no libobs loader reads obs_add_module_path() paths any more; their type only reaches callers of obs_find_modules2(). UNDEFINED, the zero value, says what this pre-type API knows. libobs's loader treats it as it treated every module before types: the disabled list applies, there is no legacy-core skip, and the loaded module is neither core nor legacy, the same as a module opened directly with obs_open_module(). LEGACY_PLUGIN would add the legacy-core skip; PLUGIN behaves the same as UNDEFINED in libobs but claims a location format the caller never stated. Upstream master has the same code and no issue or fix for it. Fixes obs-rust#1900
rdoupe
force-pushed
the
fix/module-path-type
branch
from
October 23, 2026 06:16
d773f1a to
3305519
Compare
6 of 7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1900
What and why
obs_add_module_path()built itsstruct obs_module_pathon the stack and set onlybinanddata, soobs_find_modules2()reported an uninitializedtypefor every module found on those paths. The struct is now fully initialized and the type isOBS_MODULE_TYPE_UNDEFINED.Why UNDEFINED: upstream added the type in obsproject/obs-studio@11a8445aa4 (obsproject/obs-studio#13594, "Plugin manager 1.5") and set it only on the paths the frontend plugin loaders pass to
obs_load_plugins():PLUGINfor the new locations,LEGACY_PLUGINfor the old ones. The same commit madeobs_load_all_modules()/obs_load_all_modules2()no-ops, so libobs no longer loadsobs_add_module_path()paths itself, and nothing in the tree callsobs_add_module_path(). The type only reaches callers ofobs_find_modules2(). UNDEFINED, the zero value, is what this pre-type API actually knows. libobs's loader treats it the way it treated every module before types existed: the disabled list applies, there is no legacy-core skip, and the loaded module is neither core nor legacy, the same as a module opened directly withobs_open_module().LEGACY_PLUGINwould add the legacy-core skip.PLUGINbehaves the same in libobs but claims a location format the caller never stated.Upstream master has the same code and no issue or fix for it.
The test is a new case in
test_core_module_load(no new executable). It fills the stack withOBS_MODULE_TYPE_COREbefore callingobs_add_module_path(), so an unset type always reads as CORE and never as 0 by luck. It then checks the type reported for a disabled module and for a module named like a core module, and whatobs_load_plugins()does with that type. Its code sits apart from #1894's additions to the same file, and the branch merges cleanly with #1894.RED → GREEN
test_core_module_loadmodule_path_typefails on C libobs, hybrid libobs and libobs-c-reference: both modules report type 1 (CORE), the disabled module loads, and the core-named module is marked core. The other four cases pass.test_core_module_load5/5 on C libobs, hybrid libobs and libobs-c-reference. Full ctest 385/385 on hybrid libobs and 385/385 on libobs-c-reference, 0 skipped; exported symbols identical on all three (1766);ci/local_gate.py --lane lintpasses.obs_add_module_path(); the frontend uses typed paths.Checklist
master(or the description starts with a Stacked: note)docs/features.mdis added or updated (not applicable: no user-visible change)-W..., ratchets): built with scripting ON (PR CI builds no OBS app: rungh workflow run ci.yml --ref <branch>for the full builds) and cross-checked with clang and MSVC