Skip to content

Commit

Permalink
Technically this is safe cause we fulfilled the requirement..
Browse files Browse the repository at this point in the history
  • Loading branch information
MolotovCherry committed Dec 5, 2024
1 parent f42dcae commit bc4c804
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 1 addition & 3 deletions crates/loader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ unsafe extern "system-unwind" fn Init(data: &ThreadData) -> u32 {
setup_logging(&data.log).context("failed to setup logging")?;

// blocking call which waits for all plugins to finish DllMain/Init
unsafe {
load_plugins()?;
}
load_plugins()?;

Ok::<_, Error>(())
});
Expand Down
10 changes: 6 additions & 4 deletions crates/loader/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ use windows::{

use crate::{utils::ThreadManager, Plugin, LOADED_PLUGINS};

/// # Safety
/// Any spawned threads MUST be joined. This is taken care of by ThreadManager,
/// but it is still an unsafe requirement that could be circumvented
pub unsafe fn load_plugins() -> Result<()> {
pub fn load_plugins() -> Result<()> {
// # Safety
// Any spawned threads MUST be joined. This is taken care of by ThreadManager,
// but it is still an unsafe requirement that could be circumvented.
// This function is safe because we upheld this requirement

let plugins_dir = get_bg3_plugins_dir()?;
let config = get_config()?;

Expand Down

0 comments on commit bc4c804

Please sign in to comment.