Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: make with_autorelease_pool cross-platform to fix Windows/Linux builds

Louis Beaumont851b3037cba9
diff --git a/apps/screenpipe-app-tauri/lib/utils/tauri.ts b/apps/screenpipe-app-tauri/lib/utils/tauri.ts
index 1b52309e3..708efd020 100644
--- a/apps/screenpipe-app-tauri/lib/utils/tauri.ts
+++ b/apps/screenpipe-app-tauri/lib/utils/tauri.ts
@@ -261,9 +261,9 @@ async resizeSearchWindow(width: number, height: number) : Promise<Result<null, s
* Shows Main, emits the navigation event from the app handle (not a webview),
* then closes the Search window.
*/
-async searchNavigateToTimeline(timestamp: string) : Promise<Result<null, string>> {
+async searchNavigateToTimeline(timestamp: string, frameId: bigint | null) : Promise<Result<null, string>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("search_navigate_to_timeline", { timestamp }) };
+ return { status: "ok", data: await TAURI_INVOKE("search_navigate_to_timeline", { timestamp, frameId }) };
} catch (e) {
if(e instanceof Error) throw e;
else return { status: "error", error: e as any };
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs b/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
index c1b3ba042..8c60bbc33 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
@@ -213,22 +213,26 @@ pub fn run_on_main_thread_safe<F: FnOnce() + Send + 'static>(app: &AppHandle, f:
});
}
-/// Execute `f` inside a scoped autorelease pool.
-/// Uses the modern `objc_autoreleasePoolPush/Pop` C API (what the compiler
-/// generates for `@autoreleasepool {}`) instead of the deprecated
-/// `NSAutoreleasePool` class. This avoids creating an extra ObjC object
-/// and is the recommended API on modern macOS.
-#[cfg(target_os = "macos")]
+/// Execute `f` inside a scoped autorelease pool (macOS) or just call `f` (other platforms).
+/// On macOS, uses the modern `objc_autoreleasePoolPush/Pop` C API.
+/// On other platforms, this is a no-op wrapper so callers don't need `#[cfg]` guards.
pub fn with_autorelease_pool<R, F: FnOnce() -> R>(f: F) -> R {
- extern "C" {
- fn objc_autoreleasePoolPush() -> *mut std::ffi::c_void;
- fn objc_autoreleasePoolPop(pool: *mut std::ffi::c_void);
+ #[cfg(target_os = "macos")]
+ {
+ extern "C" {
+ fn objc_autoreleasePoolPush() -> *mut std::ffi::c_void;
+ fn objc_autoreleasePoolPop(pool: *mut std::ffi::c_void);
+ }
+ unsafe {
+ let pool = objc_autoreleasePoolPush();
+ let result = f();
+ objc_autoreleasePoolPop(pool);
+ result
+ }
}
- unsafe {
- let pool = objc_autoreleasePoolPush();
- let result = f();
- objc_autoreleasePoolPop(pool);
- result
+ #[cfg(not(target_os = "macos"))]
+ {
+ f()
}
}