initialize COM in app_creator instead of local to module

This commit is contained in:
2025-12-12 03:52:40 -05:00
committed by sapphire
parent 97e1446996
commit 54985d350a
2 changed files with 6 additions and 14 deletions
+5
View File
@@ -6,10 +6,15 @@ use crate::{
util::{persistent_state::PersistentState, win},
};
use eframe::egui;
use windows::Win32::System::Com::{COINIT_APARTMENTTHREADED, CoInitializeEx};
fn app_creator(
cc: &eframe::CreationContext<'_>,
) -> Result<Box<dyn eframe::App>, Box<dyn std::error::Error + Send + Sync>> {
// initialize COM just in case
if unsafe { CoInitializeEx(None, COINIT_APARTMENTTHREADED) }.is_err() {
log::error!("couldn't initialize COM");
}
// initialize App early to modify some things before returning it
let mut app = Box::new(App::default());
// load previously selected launch platform & settings from persistent state