-
Notifications
You must be signed in to change notification settings - Fork 504
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
8301219: JavaFX crash when closing with the escape key #1307
Conversation
👋 Welcome back mfox! A progress list of the required criteria for merging this PR into |
Webrevs
|
/reviewers 2 |
@kevinrushforth |
/issue JDK-8087368 |
@beldenfox |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix looks good. I tested it by reverting your fix and leaving in the debug memory fill on delete. The system test added by this PR crashes without the fix and passes with the fix. So do the tests associated with the fixed bugs.
I also ran a headful test run on our lab systems. All good.
As for the debug fill-on-delete code, it seems useful to have it available, but not enabled in production. I recommend to ifdef it out on a flag, either DEBUG or some unique flag defined in DeletedMemDebug.h
, but off by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now. I did ask one question and will reapprove if you make the change.
|
||
static void operator delete[](void* ptr, std::size_t sz) | ||
{ | ||
::memset(ptr, 0xcc, sz); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this use FILL
instead of hard-coded 0xcc
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it should use FILL. Will fix.
@tsayao Would you like to review this? If not, can someone else be the second reviewer? |
The change looks correct to me - the change makes sense, but I can't reproduce the crash on my systems. I didn't know about the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
@beldenfox 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:
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 1 new commit pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
/integrate |
@beldenfox Pushed as commit 2493a23. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
While processing a key down event the Glass GTK code sends out PRESSED and TYPED KeyEvents back to back. If the stage is closed during the PRESSED event the code will end up referencing freed memory while sending out the TYPED event. This can lead to intermittent crashes.
In GlassApplication.cpp the EventCounterHelper object ensures the WindowContext isn't deleted while processing an event. Currently the helper object is being created after IME handling instead of before. If the IME is enabled it's possible for the WindowContext to be deleted in the middle of executing a number of keyboard-related events.
The fix is simple; instantiate the EventCounterHelper object earlier. There isn't always a WindowContext so I tweaked the EventCounterHelper to do nothing if the context is null.
To make the crash more reproducible I altered the WindowContext such that when it's deleted the freed memory is filled with 0xCC. This made the crash more reproducible and allowed me to test the fix. I did the same with GlassView since that's the only other Glass GTK class that's instantiated with
new
and discarded withdelete
.Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1307/head:pull/1307
$ git checkout pull/1307
Update a local copy of the PR:
$ git checkout pull/1307
$ git pull https://git.openjdk.org/jfx.git pull/1307/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1307
View PR using the GUI difftool:
$ git pr show -t 1307
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1307.diff
Webrev
Link to Webrev Comment