Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(macos): reuse existing CapWindowDelegate class instead of panicking if already registered
ManthanNimodiya49e844e2833c
diff --git a/apps/desktop/src-tauri/src/platform/macos/delegates.rs b/apps/desktop/src-tauri/src/platform/macos/delegates.rsindex 79860f418..29456d612 100644--- a/apps/desktop/src-tauri/src/platform/macos/delegates.rs+++ b/apps/desktop/src-tauri/src/platform/macos/delegates.rs@@ -369,8 +369,12 @@ pub fn setup<R: Runtime>(window: Window<R>, controls_inset: LogicalPosition<f64>fn get_or_register_delegate_class<R: Runtime>() -> &'static Class {static CLASS: std::sync::OnceLock<&'static Class> = std::sync::OnceLock::new();CLASS.get_or_init(|| {+ if let Some(existing) = Class::get("CapWindowDelegate") {+ return existing;+ }+let mut decl = ClassDecl::new("CapWindowDelegate", class!(NSObject))- .expect("CapWindowDelegate class already registered");+ .expect("failed to register CapWindowDelegate");decl.add_ivar::<id>("window");decl.add_ivar::<*mut c_void>("app_box");