Guard against event-tap teardown crashes; log result-window display
A tap-disabled callback force-unwrapped the tap port, which could crash
the app mid-capture (no result window, dead hotkey). Guard it and log
re-enables. Result window display is now logged with the image size.
💘 Generated with Crush
Assisted-by: Crush:deepseek-v4-flash-0731
This commit is contained in:
@@ -265,11 +265,12 @@ final class CaptureController: NSObject {
|
|||||||
guard isSelecting else { return event }
|
guard isSelecting else { return event }
|
||||||
|
|
||||||
switch type {
|
switch type {
|
||||||
case .tapDisabledByUserInput:
|
case .tapDisabledByUserInput, .tapDisabledByTimeout:
|
||||||
CGEvent.tapEnable(tap: eventTap!, enable: true)
|
// A timed-out tap must be re-enabled; guard against a torn-down tap.
|
||||||
return event
|
if let tap = eventTap {
|
||||||
case .tapDisabledByTimeout:
|
CGEvent.tapEnable(tap: tap, enable: true)
|
||||||
CGEvent.tapEnable(tap: eventTap!, enable: true)
|
CaptureController.log("tap: re-enabled after \(type)")
|
||||||
|
}
|
||||||
return event
|
return event
|
||||||
case .keyDown:
|
case .keyDown:
|
||||||
if event.getIntegerValueField(.keyboardEventKeycode) == 53 {
|
if event.getIntegerValueField(.keyboardEventKeycode) == 53 {
|
||||||
@@ -342,6 +343,7 @@ final class CaptureController: NSObject {
|
|||||||
ResultWindow.shared.show(image: ResultWindow.failureImage("Capture failed. Check Screen Recording permission."))
|
ResultWindow.shared.show(image: ResultWindow.failureImage("Capture failed. Check Screen Recording permission."))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
CaptureController.log("capture done: \(image.width)x\(image.height) — showing result window")
|
||||||
ResultWindow.shared.show(image: image)
|
ResultWindow.shared.show(image: image)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -108,9 +108,9 @@ cat > "$APP/Contents/Info.plist" <<'PLIST'
|
|||||||
<key>CFBundleIconFile</key>
|
<key>CFBundleIconFile</key>
|
||||||
<string>Icon</string>
|
<string>Icon</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>1.7.2</string>
|
<string>1.7.3</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>72</string>
|
<string>73</string>
|
||||||
<key>LSUIElement</key>
|
<key>LSUIElement</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSHighResolutionCapable</key>
|
<key>NSHighResolutionCapable</key>
|
||||||
|
|||||||
Reference in New Issue
Block a user