Looks good.

-phil

On 12/10/19 10:50 AM, Sergey Bylokhov wrote:
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.



Reply via email to