Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
22edf3f1
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看板
提交
22edf3f1
编写于
9月 24, 2012
作者:
L
leonidr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7124239: [macosx] sun.awt.SunToolkit.InfiniteLoop exception in realSync called from SwingTestHelper
Reviewed-by: anthony
上级
3347495c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
61 addition
and
5 deletion
+61
-5
src/macosx/native/sun/awt/LWCToolkit.m
src/macosx/native/sun/awt/LWCToolkit.m
+15
-5
src/macosx/native/sun/osxapp/NSApplicationAWT.h
src/macosx/native/sun/osxapp/NSApplicationAWT.h
+4
-0
src/macosx/native/sun/osxapp/NSApplicationAWT.m
src/macosx/native/sun/osxapp/NSApplicationAWT.m
+42
-0
未找到文件。
src/macosx/native/sun/awt/LWCToolkit.m
浏览文件 @
22edf3f1
...
...
@@ -33,6 +33,7 @@
#import "ThreadUtilities.h"
#import "AWT_debug.h"
#import "CSystemColors.h"
#import "NSApplicationAWT.h"
#import "sun_lwawt_macosx_LWCToolkit.h"
...
...
@@ -47,7 +48,7 @@ static long eventCount;
return
eventCount
;
}
+
(
void
)
eventCountPlusPlus
{
+
(
void
)
eventCountPlusPlus
{
eventCount
++
;
}
...
...
@@ -79,7 +80,6 @@ static long eventCount;
@end
/*
* Class: sun_lwawt_macosx_LWCToolkit
* Method: nativeSyncQueue
...
...
@@ -90,12 +90,22 @@ JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_nativeSyncQueue
{
int
currentEventNum
=
[
AWTToolkit
getEventCount
];
[
JNFRunLoop
performOnMainThreadWaiting
:
YES
withBlock
:
^
(){}];
NSApplication
*
sharedApp
=
[
NSApplication
sharedApplication
];
if
([
sharedApp
isKindOfClass
:[
NSApplicationAWT
class
]])
{
NSApplicationAWT
*
theApp
=
(
NSApplicationAWT
*
)
sharedApp
;
[
theApp
postDummyEvent
];
[
theApp
waitForDummyEvent
];
}
else
{
// could happen if we are embedded inside SWT application,
// in this case just spin a single empty block through
// the event loop to give it a chance to process pending events
[
JNFRunLoop
performOnMainThreadWaiting
:
YES
withBlock
:
^
(){}];
}
if
(([
AWTToolkit
getEventCount
]
-
currentEventNum
)
!=
0
)
{
return
JNI_TRUE
;
}
return
JNI_FALSE
;
}
...
...
src/macosx/native/sun/osxapp/NSApplicationAWT.h
浏览文件 @
22edf3f1
...
...
@@ -29,11 +29,15 @@
@interface
NSApplicationAWT
:
NSApplication
{
NSString
*
fApplicationName
;
NSWindow
*
eventTransparentWindow
;
NSTimeInterval
dummyEventTimestamp
;
NSConditionLock
*
seenDummyEventLock
;
}
-
(
void
)
finishLaunching
;
-
(
void
)
registerWithProcessManager
;
-
(
void
)
setDockIconWithEnv
:(
JNIEnv
*
)
env
;
-
(
void
)
postDummyEvent
;
-
(
void
)
waitForDummyEvent
;
+
(
void
)
runAWTLoopWithApp
:(
NSApplication
*
)
app
;
...
...
src/macosx/native/sun/osxapp/NSApplicationAWT.m
浏览文件 @
22edf3f1
...
...
@@ -52,6 +52,9 @@ BOOL postEventDuringEventSynthesis = NO;
AWT_ASSERT_APPKIT_THREAD
;
fApplicationName
=
nil
;
dummyEventTimestamp
=
0
.
0
;
seenDummyEventLock
=
nil
;
// NSApplication will call _RegisterApplication with the application's bundle, but there may not be one.
// So, we need to call it ourselves to ensure the app is set up properly.
...
...
@@ -328,6 +331,45 @@ AWT_ASSERT_APPKIT_THREAD;
return
event
;
}
// NSTimeInterval has microseconds precision
#define TS_EQUAL(ts1, ts2) (fabs((ts1) - (ts2)) < 1e-6)
-
(
void
)
sendEvent
:(
NSEvent
*
)
event
{
if
([
event
type
]
==
NSApplicationDefined
&&
TS_EQUAL
([
event
timestamp
],
dummyEventTimestamp
))
{
[
seenDummyEventLock
lockWhenCondition
:
NO
];
[
seenDummyEventLock
unlockWithCondition
:
YES
];
}
else
{
[
super
sendEvent
:
event
];
}
}
-
(
void
)
postDummyEvent
{
seenDummyEventLock
=
[[
NSConditionLock
alloc
]
initWithCondition
:
NO
];
dummyEventTimestamp
=
[
NSProcessInfo
processInfo
].
systemUptime
;
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
NSEvent
*
event
=
[
NSEvent
otherEventWithType
:
NSApplicationDefined
location:
NSMakePoint
(
0
,
0
)
modifierFlags:
0
timestamp:
dummyEventTimestamp
windowNumber:
0
context:
nil
subtype:
0
data1:
0
data2:
0
];
[
NSApp
postEvent
:
event
atStart
:
NO
];
[
pool
drain
];
}
-
(
void
)
waitForDummyEvent
{
[
seenDummyEventLock
lockWhenCondition
:
YES
];
[
seenDummyEventLock
unlock
];
[
seenDummyEventLock
release
];
seenDummyEventLock
=
nil
;
}
@end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录