Skip to content
Permalink
Browse files

8235547: Video memory leak in the OGL pipeline on macOS

Reviewed-by: prr
  • Loading branch information
mrserb committed Dec 9, 2019
1 parent 0e1b84f commit a3acb451b1de5eb8386356fde95972f5d0fdeeae
Showing with 13 additions and 10 deletions.
  1. +13 −10 src/java.desktop/macosx/classes/sun/java2d/opengl/CGLLayer.java
@@ -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,18 +25,16 @@

package sun.java2d.opengl;

import sun.lwawt.macosx.CFRetainedResource;
import sun.lwawt.LWWindowPeer;

import sun.java2d.SurfaceData;
import sun.java2d.NullSurfaceData;

import sun.awt.CGraphicsConfig;

import java.awt.Rectangle;
import java.awt.GraphicsConfiguration;
import java.awt.Rectangle;
import java.awt.Transparency;

import sun.awt.CGraphicsConfig;
import sun.java2d.NullSurfaceData;
import sun.java2d.SurfaceData;
import sun.lwawt.LWWindowPeer;
import sun.lwawt.macosx.CFRetainedResource;

public class CGLLayer extends CFRetainedResource {

private native long nativeCreateLayer();
@@ -118,6 +116,11 @@ public void validate(final CGLSurfaceData cglsd) {
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();
}

0 comments on commit a3acb45

Please sign in to comment.
You can’t perform that action at this time.