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

Bug 326941

Summary: [Table] js-error "item is undefined" when setting visibility false
Product: [RT] RAP Reporter: Tim Buschtoens <tbuschto>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: rsternberg, tbuschto
Version: 1.4   
Target Milestone: 1.4 M6   
Hardware: All   
OS: All   
Whiteboard: sr132
Attachments:
Description Flags
snippet
none
proposed fix
none
Another fix none

Description Tim Buschtoens CLA 2010-10-04 12:13:13 EDT
Created attachment 180181 [details]
snippet

To reproduce:
- Run attached snippet
- double click an table-item
Comment 1 Tim Buschtoens CLA 2010-10-04 12:19:13 EDT
- TableRow gets over state by mouse
- Items are disposed by the response-code
- table visibility is set to false by response-code
- as a result, widget._beforeDisappear removes the rows over state.
- table tries to re-render the item formerly associated with the TableRow
-> Crash
- Table.updateRows would update the associations between TableRows and TableItems, but is called too late. (See TableLCAUtil.writeItemMetrics).
Comment 2 Tim Buschtoens CLA 2010-10-04 12:20:56 EDT
Created attachment 180182 [details]
proposed fix
Comment 3 Ralf Sternberg CLA 2010-10-05 06:41:17 EDT
The patch has been applied to the 1.3 maintenance branch, it will be part of the 1.3.2 service release.
Comment 4 Ivan Furnadjiev CLA 2011-02-21 10:14:38 EST
Created attachment 189415 [details]
Another fix

When the TableItem is disposed, the Table.js#_removeItem is called, but the internal property _itemCount left unchanged. Thus, for a short period if time we have out of sync between the actual TableItem instances and the internal property _itemCount. One possible solution could be to decrement the _itemCount and update the rows in Table.js#_removeItem, but in case, disposing of multiple items will trigger the _updateRows multiple times, which will make the performance worse. The attached patch writes itemCount in the first position in TableLCA#renderChanges, ensuring that the sequential write operations will work on updated _itemCount property.
Comment 5 Tim Buschtoens CLA 2011-03-01 06:49:12 EST
Applied ivans patch to CVS HEAD.
Its the better patch because its solves the cause of the problem instead of fighting the symptoms.