<AWT Dev> [14] Review Request: 8235620 Broken merge between JDK-8006406 and JDK-8003559
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Tue Dec 10 18:50:18 UTC 2019
Hello.
Please review the fix for JDK 14.
Bug: https://bugs.openjdk.java.net/browse/JDK-8235620
Fix: http://cr.openjdk.java.net/~serb/8235620/webrev.00
I have found this bug during the hunt for the reason of why our disposing machinery is so slow.
In the sun.lwawt.macosx.CPlatformWindow both fixes changed initialize() method, pseudo diff:
JDK-8006406:
public void initialize() {
+ initializeBase(_target, _peer, _owner, new CPlatformView());
- contentView = new CPlatformView();
contentView.initialize(peer, responder);
}
JDK-8003559:
public void initialize() {
- contentView = new CPlatformView();
+ contentView = createContentView();
contentView.initialize(peer, responder);
Resulted merge:
+ initializeBase(_target, _peer, _owner, new CPlatformView());
- contentView = new CPlatformView()
+ contentView = createContentView();
contentView.initialize(peer, responder);
Note that now we create CPlatformView twice. It could be not a big issue (one more object to allocated), but it has one unexpected problem. CPlatformView is a CFRetainedResource, which calls CPlatformView.dispose() during finalization, which tried to call windowLayer.dispose(); But since we did not call contentView.initialize() on the first CPlatformView its layer is null-> this cause an NPE on the finalization thread, which eventually slow down our disposal machinery.
--
Best regards, Sergey.
More information about the awt-dev
mailing list