Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 437571

Summary: Image columns in virtual tables get messed up with scrolling and concurrent updates
Product: [RT] RAP Reporter: Stefan Be. <stefan.berkmiller>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3    
Version: 2.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Demo project none

Description Stefan Be. CLA 2014-06-17 03:05:51 EDT
Created attachment 244293 [details]
Demo project

We have a virtual TableViewer with an image column.

Sometimes new items are added in our application from a background thread. The table viewers input is then set in the UI thread via Display.asyncExec.

The problem is: When a user does concurrently scoll around, the image column gets messed up (i.e. images appear in the wrong cells).

The LazyContentProvider eventually has the ColumnLabelProvider#update(ViewerCell) method triggered. Here the texts and images of the cells are updated.

Text columns are set correctly (since they are ALWAYS set). Only image columns have a problem here. The reason is the method TableItem#setImage with Table#updateColumnImageCount. Images are only set if necessary (i.e. if a cell's image is already present, it will not be set again).

Unfortunately the image setter algorithm does not work correctly when the data changes. Like this, the SETting of cell images may be omitted. Some cells even get wrong images. The indexes do not match.

To me, it is NOT a synchronization problem. The table is updated in the UI thread. Reactions on scrolling are also processed in the UI thread. There is no real concurrency here. It just seems that the image setter mechanism in virtual tables is not designed for changes of the underlying data.

DEMO IS ATTACHED:
Start the demo. Click the "add" button and scroll around in the table. An item will then be added while you scroll. Usually only even rows have images. But the "concurrent" adding and scrolling will mess up the image column. Some odd rows will then also have images.
Comment 1 Ivan Furnadjiev CLA 2014-06-18 04:31:56 EDT
I can't reproduce it with RAP from master (3.0), but is reproducible with RAP 2.3. I think the issue was fixed couple of day before with change https://git.eclipse.org/r/#/c/28271/. Will close it as duplicate of 437198.

*** This bug has been marked as a duplicate of bug 437198 ***
Comment 2 Stefan Be. CLA 2014-07-29 08:13:34 EDT
For other developers reading this:
An easy workaround to fix the issue with RAP 2.3 is to add this line to a custom JavaScript in your application:

rwt.remote.HandlerRegistry.getHandler("rwt.widgets.GridItem").methods=["clear"];

Then the "missing" clear method will be available and everything works fine.