Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 294646 - [Table] removes same indices twice
Summary: [Table] removes same indices twice
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.3   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 1.3 M4   Edit
Assignee: Dominik Ebert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-09 13:39 EST by Benjamin Muskalla CLA
Modified: 2009-12-04 06:02 EST (History)
2 users (show)

See Also:


Attachments
Final draft (2.63 KB, patch)
2009-11-30 04:57 EST, Dominik Ebert CLA
ruediger.herrmann: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Muskalla CLA 2009-11-09 13:39:33 EST
If you use the same indicies in the same delete call, they will be processed subsequentially. We should normalize the the list by removing duplicates before deleting the items.

  public void testRemoveArrayDuplicates() throws Exception {
    Display display = new Display();
    Shell shell = new Shell( display );
    Table table = new Table( shell, SWT.NONE );
    int number = 5;
    TableItem[] items = new TableItem[ number ];
    for( int i = 0; i < number; i++ ) {
      items[ i ] = new TableItem( table, 0 );
    }
    assertEquals( 5, table.getItemCount() );
    table.remove( new int[] { 1, 1 } );
    assertEquals( 4, table.getItemCount() );
  }
Comment 1 Dominik Ebert CLA 2009-11-30 04:57:34 EST
Created attachment 153323 [details]
Final draft

Implemented, that if there is the same index twice in the array, the corresponding item is just removed one time in the method Table#remove( int[] ).
Comment 2 Rüdiger Herrmann CLA 2009-12-04 06:02:16 EST
Applied patch to CVS HEAD