Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
b47df9ef
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
b47df9ef
编写于
13年前
作者:
R
rupashka
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7072167: The "root" field in BufferStrategyPaintManager leaks memory
Reviewed-by: alexp
上级
5fadc98d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
16 deletion
+13
-16
src/share/classes/javax/swing/BufferStrategyPaintManager.java
...share/classes/javax/swing/BufferStrategyPaintManager.java
+13
-16
未找到文件。
src/share/classes/javax/swing/BufferStrategyPaintManager.java
浏览文件 @
b47df9ef
...
...
@@ -24,20 +24,17 @@
*/
package
javax.swing
;
import
java.applet.Applet
;
import
java.awt.*
;
import
java.awt.event.*
;
import
java.awt.image.*
;
import
java.lang.reflect.*
;
import
java.lang.ref.WeakReference
;
import
java.security.AccessController
;
import
java.util.*
;
import
com.sun.java.swing.SwingUtilities3
;
import
sun.awt.SubRegionShowable
;
import
sun.java2d.SunGraphics2D
;
import
sun.security.action.GetPropertyAction
;
import
sun.java2d.pipe.hw.ExtendedBufferCapabilities
;
import
sun.awt.SunToolkit
;
import
sun.util.logging.PlatformLogger
;
...
...
@@ -119,10 +116,6 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager {
* Farthest JComponent ancestor for the current paint/copyArea.
*/
private
JComponent
rootJ
;
/**
* Parent Applet/Window for the current paint/copyArea
*/
private
Container
root
;
/**
* Location of component being painted relative to root.
*/
...
...
@@ -278,7 +271,9 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager {
public
boolean
paint
(
JComponent
paintingComponent
,
JComponent
bufferComponent
,
Graphics
g
,
int
x
,
int
y
,
int
w
,
int
h
)
{
if
(
prepare
(
paintingComponent
,
true
,
x
,
y
,
w
,
h
))
{
Container
root
=
fetchRoot
(
paintingComponent
);
if
(
prepare
(
paintingComponent
,
root
,
true
,
x
,
y
,
w
,
h
))
{
if
((
g
instanceof
SunGraphics2D
)
&&
((
SunGraphics2D
)
g
).
getDestination
()
==
root
)
{
// BufferStrategy may have already constrained the Graphics. To
...
...
@@ -319,7 +314,9 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager {
//
// If the buffer isn't in sync there is no point in doing a copyArea,
// it has garbage.
if
(
prepare
(
c
,
false
,
0
,
0
,
0
,
0
)
&&
bufferInfo
.
isInSync
())
{
Container
root
=
fetchRoot
(
c
);
if
(
prepare
(
c
,
root
,
false
,
0
,
0
,
0
,
0
)
&&
bufferInfo
.
isInSync
())
{
if
(
clip
)
{
Rectangle
cBounds
=
c
.
getVisibleRect
();
int
relX
=
xOffset
+
x
;
...
...
@@ -500,14 +497,14 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager {
*
* @return true if should use buffering per window in painting.
*/
private
boolean
prepare
(
JComponent
c
,
boolean
isPaint
,
int
x
,
int
y
,
private
boolean
prepare
(
JComponent
c
,
Container
root
,
boolean
isPaint
,
int
x
,
int
y
,
int
w
,
int
h
)
{
if
(
bsg
!=
null
)
{
bsg
.
dispose
();
bsg
=
null
;
}
bufferStrategy
=
null
;
if
(
fetchRoot
(
c
)
)
{
if
(
root
!=
null
)
{
boolean
contentsLost
=
false
;
BufferInfo
bufferInfo
=
getBufferInfo
(
root
);
if
(
bufferInfo
==
null
)
{
...
...
@@ -567,10 +564,10 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager {
return
false
;
}
private
boolean
fetchRoot
(
JComponent
c
)
{
private
Container
fetchRoot
(
JComponent
c
)
{
boolean
encounteredHW
=
false
;
rootJ
=
c
;
root
=
c
;
Container
root
=
c
;
xOffset
=
yOffset
=
0
;
while
(
root
!=
null
&&
(!(
root
instanceof
Window
)
&&
...
...
@@ -597,7 +594,7 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager {
// heavyweights. If we didn't do this when we
// went to show the descendants of the nested hw
// you would see nothing, so, we bail out here.
return
false
;
return
null
;
}
}
}
...
...
@@ -613,11 +610,11 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager {
// bit tricky with Swing. This gives a good approximation
// of the various ways to turn on double buffering for
// components.
return
true
;
return
root
;
}
}
// Don't do true double buffering.
return
false
;
return
null
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录
反馈
建议
客服
返回
顶部