Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix: replacement race and dead dismissed flag

Chadpiha13dd6e7c6fb8
diff --git a/src/helpers/meetingDetectionEngine.js b/src/helpers/meetingDetectionEngine.js
index 6419469ad..061875a83 100644
--- a/src/helpers/meetingDetectionEngine.js
+++ b/src/helpers/meetingDetectionEngine.js
@@ -106,12 +106,12 @@ class MeetingDetectionEngine {
if (this._userRecording || this._postRecordingCooldown) {
debugLogger.info("Detection queued — user is recording", { detectionId, source }, "meeting");
this._notificationQueue.push({ source, key, data });
- this.activeDetections.set(detectionId, { source, key, data, dismissed: false });
+ this.activeDetections.set(detectionId, { source, key, data });
return;
}
debugLogger.info("Meeting detection triggered", { detectionId, source }, "meeting");
- this.activeDetections.set(detectionId, { source, key, data, dismissed: false });
+ this.activeDetections.set(detectionId, { source, key, data });
this._showPrompt(detectionId, source, key, data);
}
@@ -366,7 +366,7 @@ class MeetingDetectionEngine {
const detectionId = `${best.source}:${best.key}`;
const detection = this.activeDetections.get(detectionId);
- if (detection && !detection.dismissed) {
+ if (detection) {
this._showPrompt(detectionId, best.source, best.key, best.data);
}
diff --git a/src/helpers/windowManager.js b/src/helpers/windowManager.js
index e0ab10fd3..9838e700b 100644
--- a/src/helpers/windowManager.js
+++ b/src/helpers/windowManager.js
@@ -1223,10 +1223,11 @@ class WindowManager {
const display = screen.getPrimaryDisplay();
const position = WindowPositionUtil.getNotificationPosition(display);
- this.notificationWindow = new BrowserWindow({
+ const win = new BrowserWindow({
...NOTIFICATION_WINDOW_CONFIG,
...position,
});
+ this.notificationWindow = win;
// Keep the prompt visible to the user but out of screen shares and recordings.
this.notificationWindow.setContentProtection(true);
@@ -1266,7 +1267,10 @@ class WindowManager {
this._notificationDismissTimer.start(getNotificationTimeoutMs(promptData.source));
- this.notificationWindow.on("closed", () => {
+ // "closed" fires asynchronously, so a replaced prompt's window emits it
+ // after the replacement already took over the reference and the countdown.
+ win.on("closed", () => {
+ if (this.notificationWindow !== win) return;
this.notificationWindow = null;
this._notificationDismissTimer.cancel();
});
@@ -1309,10 +1313,11 @@ class WindowManager {
const display = screen.getPrimaryDisplay();
const position = WindowPositionUtil.getNotificationPosition(display);
- this.updateNotificationWindow = new BrowserWindow({
+ const win = new BrowserWindow({
...NOTIFICATION_WINDOW_CONFIG,
...position,
});
+ this.updateNotificationWindow = win;
WindowPositionUtil.setupAlwaysOnTop(this.updateNotificationWindow);
@@ -1348,7 +1353,8 @@ class WindowManager {
this.dismissUpdateNotification({ persistent: false });
}, 5000);
- this.updateNotificationWindow.on("closed", () => {
+ win.on("closed", () => {
+ if (this.updateNotificationWindow !== win) return;
this.updateNotificationWindow = null;
if (this._updateNotificationAutoDismiss) {
clearTimeout(this._updateNotificationAutoDismiss);