SWT Table with SWT.VIRTUAL raises StackOverflowError

僤鯓⒐⒋嵵緔 提交于 2019-12-24 04:05:16

问题


After recently installing Windows 7 Professional, I'm getting a strange problem removing a TableItem from a populated Table in SWT. It is specific to Windows 7 and to the SWT.VIRTUAL style constant for the table.

Consider the following code:

table = new Table(parent, SWT.VIRTUAL | Skin.SCROLL_STYLE |
                          SWT.FULL_SELECTION | SWT.BORDER);
TableItem item = new TableItem(table, SWT.NONE);
item.setText("Table item");
table.remove(0);

This causes a StackOverflowError as follows:

Caused by: java.lang.StackOverflowError
    at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:2312)
    at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:334)
    at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:200)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4036)
    at org.eclipse.swt.widgets.Table.windowProc(Table.java:5520)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:4602)
    at org.eclipse.swt.internal.win32.OS.SendMessageW(Native Method)
    at org.eclipse.swt.internal.win32.OS.SendMessage(OS.java:3106)
    at org.eclipse.swt.widgets.Table.wmNotifyChild(Table.java:6319)
    at org.eclipse.swt.widgets.Control.wmNotify(Control.java:4877)
    at org.eclipse.swt.widgets.Composite.wmNotify(Composite.java:1757)
    at org.eclipse.swt.widgets.Control.WM_NOTIFY(Control.java:4507)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4000)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:4602)
    at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
    at ...

As shown above, the stack cycles from the Display's windowProc call to the OS' CallWindowProcW; this leads me to suspect that it has something to do with the Windows 7-specific implementation of SWT. The stack trace eventually originates from the table.remove(0) line.

Testing under Vista, XP or Mac OS X gives no problems.

Removing the SWT.VIRTUAL style constant resolves the problem, but doesn't allow for custom objects in the table.

It would seem that this is a SWT bug, or am I missing something?


回答1:


Looks like a bug. Report it to the SWT guys with a test case.




回答2:


Try item.dispose() instead?



来源:https://stackoverflow.com/questions/1471142/swt-table-with-swt-virtual-raises-stackoverflowerror

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!