Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Disable crashpad init; add export progress hooks

Richie McIlroybd0c2a6ef882
diff --git a/apps/desktop/src-tauri/src/main.rs b/apps/desktop/src-tauri/src/main.rs
index 4ea22d80d..95d832709 100644
--- a/apps/desktop/src-tauri/src/main.rs
+++ b/apps/desktop/src-tauri/src/main.rs
@@ -45,9 +45,20 @@ fn main() {
));
// Caution! Everything before here runs in both app and crash reporter processes
- let _guard = tauri_plugin_sentry::minidump::init(&sentry_client);
-
- (sentry_client, _guard)
+ //
+ // DIAGNOSTIC: the minidump/crashpad initializer installs a process-wide SEH
+ // exception handler that intercepts native crashes, writes a minidump, uploads
+ // to Sentry, then terminates the process via TerminateProcess. That termination
+ // path bypasses the Rust panic hook, Tauri's RunEvent::Exit, and Windows Error
+ // Reporting, which is why the export-time crashes have left zero forensic trail
+ // (no panics.log, no WER Application Error event, no App exit requested log).
+ // We've eliminated several candidate root causes already; the remaining unknown
+ // requires a real native stack trace. Disabling crashpad lets the next crash
+ // propagate to Windows Error Reporting so Event Viewer captures the faulting
+ // module + offset. RE-ENABLE THIS LINE as soon as we have the WER trace.
+ // let _guard = tauri_plugin_sentry::minidump::init(&sentry_client);
+
+ sentry_client
});
let (reload_layer, handle) = tracing_subscriber::reload::Layer::new(None::<DynLoggingLayer>);
diff --git a/apps/desktop/src/routes/recordings-overlay.tsx b/apps/desktop/src/routes/recordings-overlay.tsx
index d1942c4c2..d2e05c9fc 100644
--- a/apps/desktop/src/routes/recordings-overlay.tsx
+++ b/apps/desktop/src/routes/recordings-overlay.tsx
@@ -673,6 +673,15 @@ function createRecordingMutations(
fullFileName,
fileType,
createRenderProgressCallback("save", setActionState),
+ () => {
+ setActionState({
+ type: "save",
+ state: { type: "rendering", state: { type: "starting" } },
+ });
+ },
+ () => {
+ setActionState({ type: "save", state: { type: "saving" } });
+ },
);
await promise;
diff --git a/apps/desktop/src/utils/export.ts b/apps/desktop/src/utils/export.ts
index 873d5dc8f..0b7cad191 100644
--- a/apps/desktop/src/utils/export.ts
+++ b/apps/desktop/src/utils/export.ts
@@ -44,9 +44,21 @@ export function createExportToFileTask(
fileName: string,
fileType: string,
onProgress: (progress: FramesRendered) => void,
+ onStart?: () => void,
+ onCopying?: () => void,
) {
+ let started = false;
+ let copying = false;
const progress = new Channel<FramesRendered>((e) => {
+ if (!started) {
+ started = true;
+ onStart?.();
+ }
onProgress(e);
+ if (!copying && e.totalFrames > 0 && e.renderedCount >= e.totalFrames) {
+ copying = true;
+ onCopying?.();
+ }
});
let closed = false;
const cancel = () => {
@@ -59,23 +71,9 @@ export function createExportToFileTask(
).__TAURI_INTERNALS__;
internals?.unregisterCallback?.(progress.id);
};
- const promise = (async () => {
- const releaseExportSession = await beginExportSessionGuard();
- try {
- const savePath = await commands.saveFileDialog(fileName, fileType);
- if (!savePath) throw new Error("Save dialog cancelled");
-
- const outputPath = await commands.exportVideo(
- projectPath,
- progress,
- settings,
- );
- await commands.copyFileToPath(outputPath, savePath);
- return savePath;
- } finally {
- await releaseExportSession();
- }
- })().finally(cancel);
+ const promise = commands
+ .exportVideoToFile(projectPath, progress, settings, fileName, fileType)
+ .finally(cancel);
return { promise, cancel };
}
@@ -88,19 +86,16 @@ export async function exportVideoToFile(
onCopying: () => void,
onProgress: (progress: FramesRendered) => void,
) {
- const releaseExportSession = await beginExportSessionGuard();
- try {
- const savePath = await commands.saveFileDialog(fileName, fileType);
- if (!savePath) throw new Error("Save dialog cancelled");
-
- onStart();
- const videoPath = await exportVideo(projectPath, settings, onProgress);
- onCopying();
- await commands.copyFileToPath(videoPath, savePath);
- return savePath;
- } finally {
- await releaseExportSession();
- }
+ const { promise } = createExportToFileTask(
+ projectPath,
+ settings,
+ fileName,
+ fileType,
+ onProgress,
+ onStart,
+ onCopying,
+ );
+ return await promise;
}
export async function exportVideo(