-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: NPE preventing HTML 5 dialogs from submitting #4048
Comments
Bisected this to 1ddaa7b |
This issue is not unique to submit buttons, . The same error happens for plain buttons and anchors (with or without an href), and probably plenty of other interactable elements (not Unfortunately I haven't had much luck pinning down the root cause. The failure is in native code for some invisible resource, and so far everything I can see in Javaland looks fine. After reverting JavaFX to version 18, I could no longer reproduce the issue, while on JavaFX 19 and 20 it is pretty consistently showing up. So one solution would be to downgrade. I tried out some different code changes as well to see if we can work around the problem and stay on JavaFX 20. One thing that worked was to discard the Another thing I noticed was that the I also added some threading checks to make sure all methods of |
It’s a shame to hear it’s a regression in JFX 19 and 20 (or appears to be, at least). JFX 20 fixes an issue where the jQuery-UI library’s Tabs feature wasn’t working. (Same code work on v20 but not v18. I didn’t dig into why.) |
Progress update: I found two different low-level aspect that seems to interact to create this issue:
Removing either will avoid the NPE from occuring (of course, removing the latter also means submits don't work at all 😅. But this is just debugging progress, not a suggestion for implementation). I don't think we're doing anything wrong there. My working theory is that JavaFX is just losing / messing up the association between the Java listeners and their native peers when the page changes, possibly because it's cached the Java listener but doesn't invalidate the listener's peer when a new page is loaded 🤷 Whether or not this is accurate, the behaviour I'm seeing suggests we may be able to work around it by registering listener in JS rather than Java, and forward the events via our bridge code as that stuff seems to be working fine. Have yet to test this though. |
I have found another non useable work around... If I run it from the IDE in debug mode it never fails for me... I hate when that happens |
I've found that a fix went in for JavaFX 19 to allow garbage collection of EventTarget listeners: JDK-8088420. Quite possible that change included some undesirable behaviour. I'm going to try reproduce this in a minimal example, and if I can I will report it to the JavaFX team. Then I'll keep looking for a workaround. |
I've found the key to be whether a GC cycle runs while the page is unloaded. So waiting a bit before reopening the dialog will more reliably result in a breakage. This also explains why reloading the campaign made it more consistent for me originally. I've reproduced this in a minimal example that I will send to the JavaFX team. In the meantime, a very simple workaround has presented itself, so I'll put a PR together for that. |
Finally my bug report got added to the JDK bug tracker: JDK-8315915. |
We're seeing redundant events being fired since the attempted fix, e.g., when clicking macro links. Will have to look into how we can avoid this. |
Looks like #4285 has had other adverse effects. My mistaken assumption was that our |
Update on JDK-8315915: it looks like it will be fixed in JavaFX 22. Did some very quick testing and it seems to be the case. |
Closing this off as there was confirmation in Discord at the time that this was fixed, and there haven't been further reports to the contrary. |
Describe the Bug
In some circumstances, after reopening an HTML5 dialog, the dialog can no longer be closed via a submit button.
To Reproduce
Expected Behaviour
The dialog form should be submitted, handled via the macro referenced in the form action, and the dialog should then be closed.
Screenshots
No response
MapTool Info
develop (f0c70b5)
Desktop
Linux Mint 21.1
Additional Context
This is new on the
develop
branch and does not affect the 1.13 release.Reopening the campaign is not strictly necessary, but I have found it tends to be more consistently reproducable that way.
The failure to submit is accompanied by this exception:
The text was updated successfully, but these errors were encountered: