fix: prevent concurrent transcription races and mask API key

This commit is contained in:
Your Name
2026-06-09 19:39:27 -07:00
parent fe21a41532
commit 062f09a000
10 changed files with 159 additions and 46 deletions
+14
View File
@@ -99,6 +99,8 @@ type Overlay struct {
mu sync.RWMutex
stopCh chan struct{}
bgBrush syscall.Handle
barBrushWhite syscall.Handle // Pre-created GDI brush for white bars (recording animation)
barBrushOrange syscall.Handle // Pre-created GDI brush for orange bars (transcribing animation)
hFont syscall.Handle
volume uint64 // atomic: float64 stored via math.Float64bits
smoothedVolume uint64 // atomic: float64 stored via math.Float64bits
@@ -171,6 +173,12 @@ func (o *Overlay) Close() {
if o.hFont != 0 {
procDeleteObject.Call(uintptr(o.hFont))
}
if o.barBrushWhite != 0 {
procDeleteObject.Call(uintptr(o.barBrushWhite))
}
if o.barBrushOrange != 0 {
procDeleteObject.Call(uintptr(o.barBrushOrange))
}
close(o.stopCh)
}
@@ -193,6 +201,12 @@ func (o *Overlay) run() {
brushRec, _, _ := procCreateSolidBrush.Call(COLOR_BG_DARK)
o.bgBrush = syscall.Handle(brushRec)
whiteRec, _, _ := procCreateSolidBrush.Call(uintptr(COLOR_WHITE))
o.barBrushWhite = syscall.Handle(whiteRec)
orangeRec, _, _ := procCreateSolidBrush.Call(uintptr(COLOR_MIC_ORANGE))
o.barBrushOrange = syscall.Handle(orangeRec)
fontName := syscall.StringToUTF16Ptr("Segoe UI")
fontRec, _, _ := procCreateFontW.Call(
18, 0, 0, 0, 600,