提交 eba31493 编写于 作者: R rkennke

6759311: RepaintManager casts Tookit to SunToolkit without instanceof check

Summary: Check type of Toolkit before casting.
Reviewed-by: alexp
上级 e30f55d6
...@@ -1305,10 +1305,13 @@ public class RepaintManager ...@@ -1305,10 +1305,13 @@ public class RepaintManager
if (doubleBufferingEnabled && !nativeDoubleBuffering) { if (doubleBufferingEnabled && !nativeDoubleBuffering) {
switch (bufferStrategyType) { switch (bufferStrategyType) {
case BUFFER_STRATEGY_NOT_SPECIFIED: case BUFFER_STRATEGY_NOT_SPECIFIED:
if (((SunToolkit)Toolkit.getDefaultToolkit()). Toolkit tk = Toolkit.getDefaultToolkit();
useBufferPerWindow()) { if (tk instanceof SunToolkit) {
SunToolkit stk = (SunToolkit) tk;
if (stk.useBufferPerWindow()) {
paintManager = new BufferStrategyPaintManager(); paintManager = new BufferStrategyPaintManager();
} }
}
break; break;
case BUFFER_STRATEGY_SPECIFIED_ON: case BUFFER_STRATEGY_SPECIFIED_ON:
paintManager = new BufferStrategyPaintManager(); paintManager = new BufferStrategyPaintManager();
...@@ -1329,9 +1332,16 @@ public class RepaintManager ...@@ -1329,9 +1332,16 @@ public class RepaintManager
private void scheduleProcessingRunnable(AppContext context) { private void scheduleProcessingRunnable(AppContext context) {
if (processingRunnable.markPending()) { if (processingRunnable.markPending()) {
Toolkit tk = Toolkit.getDefaultToolkit();
if (tk instanceof SunToolkit) {
SunToolkit.getSystemEventQueueImplPP(context). SunToolkit.getSystemEventQueueImplPP(context).
postEvent(new InvocationEvent(Toolkit.getDefaultToolkit(), postEvent(new InvocationEvent(Toolkit.getDefaultToolkit(),
processingRunnable)); processingRunnable));
} else {
Toolkit.getDefaultToolkit().getSystemEventQueue().
postEvent(new InvocationEvent(Toolkit.getDefaultToolkit(),
processingRunnable));
}
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册