Skip to content

πŸͺŸ [Bug] Modern Recorder: the "Choose image source" popup ghosts into the capture overlayΒ #387

Description

@julienmerconsulting

Type
Module
Related

🎯 Summary

In the Modern Recorder, when you pick an image action and choose Capture screen, the "Choose image source" dialog stays painted on screen during the capture overlay β€” faint, but clearly there, and it gets baked into the captured region's backdrop.

This one's self-inflicted: it's my code (RecorderImagePicker, added in 3.0.3), not inherited. Reporting it on myself so it's tracked properly. (Different bug from #386 β€” that one is the live recorder's element-blind crop of the target UI, with no tool-UI leak involved. Filed separately to keep them clear.)

πŸ”¬ Reproduction

  1. Tools β†’ 🟒 Modern Recorder β†’ Click (or any image action).
  2. Choose Capture screen.
  3. The IDE hides and the capture overlay appears β€” but the "Choose image source for: click" popup is still floating in the middle, ghosted over the overlay (and into the grabbed screenshot).

🧬 Root cause β€” and why I got it wrong

RecorderImagePicker:

// pickImage(): modal source dialog
int choice = JOptionPane.showOptionDialog(parent, ...);   // "Capture screen / Browse…"
...
parent.setAlwaysOnTop(false);
return captureImage(purpose);

// captureImage(): hide, then capture IMMEDIATELY
parent.setVisible(false);
parent.getOwner().setVisible(false);
captured[0] = new Screen().userCapture("Select region for " + purpose);   // ← snapshots NOW

I assumed that showOptionDialog returning + setVisible(false) meant the windows were gone. They aren't: those are asynchronous native operations queued on the EDT, and userCapture() runs synchronously on that same EDT tick β€” it grabs the screen before the dialog's dispose and the window hides have actually been painted away. So the capture overlay's backdrop snapshot still contains the popup.

In one line: I captured the screen before the screen had a chance to clean itself up.

πŸ’₯ Impact

Every Capture in the Modern Recorder bakes a faint ghost of the source-select popup into the working screenshot β€” visually ugly, and it can pollute the captured region when the click is near the center.

πŸ”§ Fix direction

Let the EDT process the dismiss + the hides before snapshotting: defer userCapture() by one tick (SwingUtilities.invokeLater after hiding the windows), and/or a short settle. This mirrors how the classic IDE Capture button hides the window before grabbing. Localized to captureImage() β€” no behaviour change beyond the timing.

🦎

Metadata

Metadata

Labels

Type

Fields

No fields configured for Bug.

Projects

Status
πŸ“‹ Backlog

Relationships

None yet

Development

No branches or pull requests

Issue actions