SWT table with SWT.VIRTUAL raises StackOverflowError
After installing Windows 7 Professional, I had a weird problem with removing a TableItem from a populated table in SWT. It is Windows 7 specific and style constants SWT.VIRTUAL
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 raises a StackOverflowError like this:
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 loop from the Display call windowProc
to the OS ' CallWindowProcW
; this makes me suspect it has something to do with the Windows 7 specific SWT implementation. The stack trace ultimately comes from a string table.remove(0)
.
Testing under Vista, XP or Mac OS X does not pose a problem.
Removing the style constant SWT.VIRTUAL
fixes the problem, but prevents the creation of custom objects in the table.
It would seem this is a SWT bug, or am I missing something?
source to share