Skip to content

8334868: Ensure CheckUninstallModalHook is called in WPageDialogPeer._show#30207

Closed
aivanov-jdk wants to merge 4 commits into
openjdk:masterfrom
aivanov-jdk:8334868-cleanup-WPageDialogPeer._show-v2
Closed

8334868: Ensure CheckUninstallModalHook is called in WPageDialogPeer._show#30207
aivanov-jdk wants to merge 4 commits into
openjdk:masterfrom
aivanov-jdk:8334868-cleanup-WPageDialogPeer._show-v2

Conversation

@aivanov-jdk
Copy link
Copy Markdown
Member

@aivanov-jdk aivanov-jdk commented Mar 11, 2026

This is a re-worked version of my previous attempt to fix the issue that was found during code review #19786 (comment) for JDK-8334509.

To ensure AwtDialog::CheckInstallModalHook() and AwtDialog::ModalActivateNextWindow are always called, I moved them from the bottom of the function. Now these functions are called right after displaying the page dialog, that is after ::PageSetupDlg returns.

I reversed the condition of the if statement to if (!ret) and exit from the function right away if ::PageSetupDlg returned an error.

The diff looks large because the body of the if is unindented.

With this change, I modify the data flow and remove the doIt flag. The data flow with the flag is not as clear, and I already raised my concern. I'm sure this is what caused JDK-8334509.

There was only one place where JNI_TRUE is assigned to the doIt flag—in the end of the if (ret) block. Therefore, the last return statement in the WPageDialogPeer__1show function could have either JNI_FALSE or JNI_TRUE stored in the doIt flag. In all the other return statements, the value of doIt remains JNI_FALSE.

It was the mistake in #18584 that assumed JNI_TRUE was the only possibility in the end of the function.

By returning early if ::PageSetupDlg results in an error, I eliminate the above possibility—if the last return statement in WPageDialogPeer__1show is reached, it has to return JNI_TRUE.

All the other return statements explicitly return JNI_FALSE… because an error occurred.

To verify that this change does not introduce another regression,

Additionally, I ensure ::GlobalUnlock(setup.hDevMode) is called on the error return from the block at lines 687–700.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 2 Reviewers)

Issue

  • JDK-8334868: Ensure CheckUninstallModalHook is called in WPageDialogPeer._show (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 30207

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper Bot commented Mar 11, 2026

👋 Welcome back aivanov! 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 Mar 11, 2026

@aivanov-jdk This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8334868: Ensure CheckUninstallModalHook is called in WPageDialogPeer._show

Ensure AwtDialog::CheckInstallModalHook and
AwtDialog::ModalActivateNextWindow are always called
after ::PageSetupDlg returns.

Reverse the condition of the if statement and
bail out if ::PageSetupDlg returns an error.

Remove the doIt flag and use explicit returns:
* JNI_FALSE if an error detected;
* JNI_TRUE  if the function reached its end
without errors.

Reviewed-by: dmarkov, prr

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 393 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk Bot added the client client-libs-dev@openjdk.org label Mar 11, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented Mar 11, 2026

@aivanov-jdk 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 Mar 11, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge Bot commented Mar 11, 2026

Webrevs

@aivanov-jdk
Copy link
Copy Markdown
Member Author

@prrace and @prsadhuk, please review.

@jaokim
Copy link
Copy Markdown
Contributor

jaokim commented Mar 12, 2026

This looks much better compared to with the doIt flag and the long if (ret) {...}. Much less error prone, and easier to comprehend.
Thanks for fixing!

@openjdk openjdk Bot added the ready Pull request is ready to be integrated label Mar 12, 2026
@aivanov-jdk
Copy link
Copy Markdown
Member Author

/reviewers 2 reviewer

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Mar 16, 2026

@aivanov-jdk
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 2 Reviewers).

@openjdk openjdk Bot removed the ready Pull request is ready to be integrated label Mar 16, 2026
Copy link
Copy Markdown
Contributor

@prrace prrace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@openjdk openjdk Bot added the ready Pull request is ready to be integrated label Mar 27, 2026
@aivanov-jdk
Copy link
Copy Markdown
Member Author

/summary
Ensure AwtDialog::CheckInstallModalHook and
AwtDialog::ModalActivateNextWindow are always called
after ::PageSetupDlg returns.

Reverse the condition of the if statement and
bail out if ::PageSetupDlg returns an error.

Remove the doIt flag and use explicit returns:

  • JNI_FALSE if an error detected;
  • JNI_TRUE if the function reached its end
    without errors.

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 9, 2026

@aivanov-jdk Setting summary to:

Ensure AwtDialog::CheckInstallModalHook and
AwtDialog::ModalActivateNextWindow are always called
after ::PageSetupDlg returns.

Reverse the condition of the if statement and
bail out if ::PageSetupDlg returns an error.

Remove the doIt flag and use explicit returns:
* JNI_FALSE if an error detected;
* JNI_TRUE  if the function reached its end
without errors.

@aivanov-jdk
Copy link
Copy Markdown
Member Author

/integrate

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 10, 2026

Going to push as commit 8357de8.
Since your change was applied there have been 398 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk Bot added the integrated Pull request has been integrated label Apr 10, 2026
@openjdk openjdk Bot closed this Apr 10, 2026
@openjdk openjdk Bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Apr 10, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 10, 2026

@aivanov-jdk Pushed as commit 8357de8.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

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 integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

4 participants