`

Ogre4J 使用中错误总结

阅读更多

1、EXCEPTION_ACCESS_VIOLATION

#
# An unexpected error has been detected by Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x69f4b686, pid=400, tid=5828
#
# Java VM: Java HotSpot(TM) Client VM (11.3-b02 mixed mode windows-x86)
# Problematic frame:
# C  [atioglxx.dll+0xf1b686]
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

 

这是指你去碰了不该碰的东西,越界了,也就是说在一个非UI线程去操作了UI线程。因为,SWT 在底层设计时不允许其他的线程访问 UI 线程,这样你就犯错了,所以在使用UI线程时要加上一句

swtShell.getDisplay().asyncExec(new Runnable() { 
	public void run() {
		updateAssets((Map<String, MonitorObject>) peoples);						
	}
});

 

2、java.util.ConcurrentModificationException

工作中碰到个ConcurrentModificationException。代码如下:
List list = ...;
for(Iterator iter = list.iterator(); iter.hasNext();) {
    Object obj = iter.next();
    ...
    if(***) {
        list.remove(obj);
    }
}
在执行了remove方法之后,再去执行循环,iter.next()的时候,报java.util.ConcurrentModificationException(当然,如果remove的是最后一条,就不会再去执行next()操作了)

总而言之,是你的list在你循环的时候,被你修改了,所以才报错。

 

 

1
3
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics