You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "rkeen-siemens (via GitHub)" <gi...@apache.org> on 2025/07/22 17:55:22 UTC
[I] Dialog owner can be a closed window [netbeans]
rkeen-siemens opened a new issue, #8667:
URL: https://github.com/apache/netbeans/issues/8667
### Apache NetBeans version
Apache NetBeans 26
### What happened
`Utilities.findDialogParent` can return a non-visible component which is effectively equivalent to null and will cause issues similar to #4739 and #5987.
### Language / Project Type / NetBeans Component
_No response_
### How to reproduce
Run the following code on the EDT:
```java
DialogDescriptor first = new DialogDescriptor("Parent is the main window", "First");
DialogDisplayer.getDefault().notify(first);
DialogDescriptor second = new DialogDescriptor("Parent is first's dialog", "Second");
DialogDisplayer.getDefault().notify(second);
```
The first dialog will have the main window as the parent, but the second will have the dialog created for `first` even though it has been closed.
### Did this work correctly in an earlier version?
No / Don't know
### Operating System
Linux
### JDK
21.0.5
### Apache NetBeans packaging
Apache NetBeans platform
### Anything else
Here's what seems to be happening:
1. Closing the first dialog submits a `WINDOW_CLOSED` event to the event queue
2. Before the event is processed, `notify` opens the second dialog
3. This end up in `DialogDisplayerImpl.AWTQuery.showDialog()` which ultimately gets the new dialog’s parent using `org.openide.util.Utilities.findDialogParent`
4. This returns the active window from `KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow()` which is still the now closed first dialog because the `WINDOW_CLOSED` event hasn’t yet been processed
Updating `Utilities.findDialogParent` to resolve a suggested parent via the closed window's owner would probably resolve the issue. Something like this after the modal check may work:
```java
if (parent instanceof Window w) {
while (!w.isVisible()) {
w = w.getOwner();
if (w == null) {
break;
}
}
parent = w;
}
```
### Are you willing to submit a pull request?
No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [I] Dialog parent can be a closed window [netbeans]
Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
neilcsmith-net commented on issue #8667:
URL: https://github.com/apache/netbeans/issues/8667#issuecomment-3106976014
That seems somewhat like a JDK bug, but PR welcome.
As a workaround, does using `setLeaf(true)` help? Or run the second dialog via `EventQueue::invokeLater`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [I] Dialog parent can be a closed window [netbeans]
Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
neilcsmith-net commented on issue #8667:
URL: https://github.com/apache/netbeans/issues/8667#issuecomment-3112621626
@mbien yes, and curious what the behaviour of that was prior to #5989 Happy if @rkeen-siemens wants to fix his original fix, but needs something with a reproducer that can be properly tested across OS. I still have scars from the last look at this! :smile:
Unfortunately, I think the JDK behaviour is somewhat broken. The desire to make Dialog synchronous and the secondary EDT just has too many quirks like this for my liking. I often find myself using dialogs via invokeLater to ensure events have run through. Curious if the bug is also reproducible with https://bits.netbeans.org/26/javadoc/org-openide-dialogs/org/openide/DialogDisplayer.html#notifyFuture(T) That might be a better API for combining dialogs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [I] Dialog parent can be a closed window [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on issue #8667:
URL: https://github.com/apache/netbeans/issues/8667#issuecomment-3110581217
reminds me on https://github.com/apache/netbeans/pull/6772
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [I] Dialog parent can be a closed window [netbeans]
Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
neilcsmith-net closed issue #8667: Dialog parent can be a closed window
URL: https://github.com/apache/netbeans/issues/8667
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists