8235547: Video memory leak in the OGL pipeline on macOS

Reviewed-by: prr
This commit is contained in:
Sergey Bylokhov 2019-12-09 14:59:33 -08:00
parent 0e1b84f90e
commit a3acb451b1

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,17 +25,15 @@
package sun.java2d.opengl;
import sun.lwawt.macosx.CFRetainedResource;
import sun.lwawt.LWWindowPeer;
import sun.java2d.SurfaceData;
import sun.java2d.NullSurfaceData;
import java.awt.GraphicsConfiguration;
import java.awt.Rectangle;
import java.awt.Transparency;
import sun.awt.CGraphicsConfig;
import java.awt.Rectangle;
import java.awt.GraphicsConfiguration;
import java.awt.Transparency;
import sun.java2d.NullSurfaceData;
import sun.java2d.SurfaceData;
import sun.lwawt.LWWindowPeer;
import sun.lwawt.macosx.CFRetainedResource;
public class CGLLayer extends CFRetainedResource {
@ -118,6 +116,11 @@ public class CGLLayer extends CFRetainedResource {
public void dispose() {
// break the connection between the layer and the buffer
validate(null);
SurfaceData oldData = surfaceData;
surfaceData = NullSurfaceData.theInstance;;
if (oldData != null) {
oldData.flush();
}
super.dispose();
}