Skip to content

7186009: [macOS] No way to hide(), dispose() FileDialog#30715

Open
prrace wants to merge 2 commits intoopenjdk:masterfrom
prrace:awt_filedialog_dispose
Open

7186009: [macOS] No way to hide(), dispose() FileDialog#30715
prrace wants to merge 2 commits intoopenjdk:masterfrom
prrace:awt_filedialog_dispose

Conversation

@prrace
Copy link
Copy Markdown
Contributor

@prrace prrace commented Apr 13, 2026

There are about 26 modal FileDialog tests marked as failing on macOS due to this bug.
They test the various modality cases for FileDialog.

The missing macOS support for FileDialog.dispose() affects these tests since they require dispose()
to work to dismiss the dialogs after checking the modality support.

In the macOS native code the FileDialog (an NSOpenPanel) is displayed by calling a macOS API "runModalWithDirectory". So it is modal.
That runModalWithDirectory API is deprecated, but the replacement "runModal" is the same as far as this issue goes.
There is no macOS API to directly hide or progammatically "cancel" the dialog. In fact the latter is explicitly disallowed.

But I have found that there is a macOS API "stopModal" which will break the loop and dismiss the dialog.
It seems to work well for these tests. There is a corner-case issue that stopModal doesn't take a window parameter.
Therefore care needs to be taken so that we only stop the loop if the current modal window is the one for this FileDialog.

24 of the 26 tests assume application modal behaviour of the dialog and pass with that fix.

Also the ones marked as failing on Linux haven't failed at all for me in all my test runs, so all of these are de-problem listed.

The 2 that still fail because they require docmodal/modeless are marked as !Mac
Per the spec there's no requirement to support this, even though apparently Linux & Mac do.

class doc says : "The FileDialog class displays a dialog window from which the user can select a file.
Since it is a modal dialog, when the application calls its show method to display the dialog, it blocks the rest of the application until the user has chosen a file."

The change to test !inDispose is fully explained in the JBS issue, but briefly it is required to prevent
the thread running the dialog from hanging if dispose is called by the application.



Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-7186009: [macOS] No way to hide(), dispose() FileDialog (Bug - P3)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/30715/head:pull/30715
$ git checkout pull/30715

Update a local copy of the PR:
$ git checkout pull/30715
$ git pull https://git.openjdk.org/jdk.git pull/30715/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 30715

View PR using the GUI difftool:
$ git pr show -t 30715

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/30715.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper bot commented Apr 13, 2026

👋 Welcome back prr! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link
Copy Markdown

openjdk bot commented Apr 13, 2026

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot changed the title 7186009 7186009: [macOS] No way to hide(), dispose() FileDialog Apr 13, 2026
@openjdk openjdk bot added the client client-libs-dev@openjdk.org label Apr 13, 2026
@openjdk
Copy link
Copy Markdown

openjdk bot commented Apr 13, 2026

@prrace The following label will be automatically applied to this pull request:

  • client

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 13, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge bot commented Apr 13, 2026

Webrevs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client client-libs-dev@openjdk.org rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

1 participant