Community
Participate
Working Groups
Build Identifier: 3.7.0 (I20110613-1736) AVG is a popular free anti-virus program, but their latest version seems to cause SWT virtual tables to crash. Reproducible: Always Steps to Reproduce: 1. Download and install the free version of AVG here: http://free.avg.com/au-en/free-antivirus-download 2. Run the snippet shown below. 3. When the table appears, scroll up and down for about 15 seconds. Eventually the following exception is thrown: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3 at org.eclipse.swt.widgets.Table.wmNotifyChild(Table.java:6743) at org.eclipse.swt.widgets.Control.wmNotify(Control.java:5534) at org.eclipse.swt.widgets.Composite.wmNotify(Composite.java:1896) at org.eclipse.swt.widgets.Control.WM_NOTIFY(Control.java:5086) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4584) at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341) at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1610) at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2061) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4985) at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method) at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:2424) at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:564) at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:430) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4623) at org.eclipse.swt.widgets.Table.windowProc(Table.java:5893) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4985) at org.eclipse.swt.internal.win32.OS.PeekMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.PeekMessage(OS.java:3095) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3749) at TestVirtualTable.main(TestVirtualTable.java:64) ------------------- code snippet ------------------------- import org.eclipse.swt.SWT; import org.eclipse.swt.layout.RowData; import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.TableItem; /** * A version of Snippet 144 with columns added. */ public class TestVirtualTable { static final int COUNT = 200; public static void main(String[] args) { Display display = new Display (); final Shell shell = new Shell (display); shell.setLayout (new RowLayout (SWT.VERTICAL)); final Table table = new Table (shell, SWT.VIRTUAL | SWT.BORDER); table.addListener (SWT.SetData, new Listener () { public void handleEvent (Event event) { if(event.index < 0) { throw new RuntimeException("Index < 0"); } TableItem item = (TableItem) event.item; int index = table.indexOf (item); String randomString = ("" + Math.random()).substring(2, 4); item.setText(0, randomString); item.setText (1, "Foo bah do"); item.setText(2, "Item " + index); } }); table.setLayoutData (new RowData (200, 200)); createColumns(table); Button button = new Button (shell, SWT.PUSH); button.setText ("Add Items"); button.addListener (SWT.Selection, new Listener () { public void handleEvent (Event event) { table.clearAll(); table.setItemCount (COUNT + 2); shell.layout (); } }); table.setItemCount (COUNT); shell.pack (); shell.open (); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); } private static void createColumns(Table tbl) { String[] titles = {" ", "Name", "Size"}; for (int i = 0; i < titles.length; i++) { TableColumn column = new TableColumn (tbl, SWT.VIRTUAL); column.setText(titles [i]); column.setWidth(50); } } }
Does it happen if AVG is not installed ?
No - as far as I can tell this bug only occurs when AVG is installed. Also note that disabling the 'Identity Theft Protection' feature of AVG will stop the exception from being thrown.
The same probleme here... Two my customers have reported problems after installing AVG Free Edition...
I resolved this problem by copying the Table class and editing the wmNotifyChild method to check that plvfi.iSubItem is not greater than the number of table columns: ie. original: String[] strings = item.strings; if (strings != null) string = strings[plvfi.iSubItem]; my version: String[] strings = item.strings; if (strings != null && plvfi.iSubItem < strings.length) string = strings[plvfi.iSubItem];
We just started getting calls on this exact issue. Thanks for the fix. Two questions: - Is this something that will be included in a future build of swt? - Is this something that the eclipse organization can report to AVG? If it's modifying parameters from the windows messages and screwing them up, who knows what other kind of wacky damage they are causing. Seems that a report from Eclipse about this might carry far more weight than anything I could do, but we'll try anyway. Larry Colson Auto/Mate, Inc.
(In reply to comment #5) > We just started getting calls on this exact issue. Thanks for the fix. Two > questions: > - Is this something that will be included in a future build of swt? I don't mind adding the check to the SWT code base. That said, if would be good to know why AVG is doing to cause this. Please, report a bug against them.
Agreed. It was submitted it to them earlier today and linked them to this bug report. I'll post what I find out. LC
Fixed in HEAD http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=448b28b4464a4c39dc1bd29fd464e5ceb34098ef Please, keep us post if you learn anything from the AVG problem report. Thank you.