| Summary: | [TabFolder] Sends unwanted selection events when disposed | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Heiner Napp <h.napp> | ||||
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | major | ||||||
| Priority: | P3 | CC: | ruediger.herrmann | ||||
| Version: | 2.1 | ||||||
| Target Milestone: | 2.2 M1 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | sr211 | ||||||
| Attachments: |
|
||||||
|
Description
Heiner Napp
If a TabFolder is disposed, a selection event is sent for each TabItem it contains. I think this is a regression that was introduced while resolving bug 407882. (In reply to comment #1) > If a TabFolder is disposed, a selection event is sent for each TabItem it > contains. > I think this is a regression that was introduced while resolving bug 407882. Absolutely correct. Here is a test case: @Test public void testDispose_doesNotFireSelectionEvent() { createItems( folder, 3 ); Listener listener = mock( Listener.class ); for( int i = 0; i < 3; i++ ) { folder.getItem( i ).addListener( SWT.Selection, listener ); } folder.dispose(); verify( listener, times( 0 ) ).handleEvent( any( Event.class ) ); } Correct test case:
@Test
public void testDispose_doesNotFireSelectionEvent() {
createItems( folder, 3 );
Listener listener = mock( Listener.class );
folder.addListener( SWT.Selection, listener );
folder.dispose();
verify( listener, times( 0 ) ).handleEvent( any( Event.class ) );
}
Created attachment 232027 [details]
Patch that fixes the issue
This patch adds a check if folder isInDispose in TabFolder#destroyItem
It's too late to be fixed in 2.1. Will be pushed to master after the 2.1-maintenance branch is created. Marked as proposed fix for 2.1 SR1.
Fixed in master with commit e05b8873ecfc1bf8a6a90e2f2cb078c433f674a7. +1 to backport this fix to 2.1.1 Backported to 2.1-maintenance branch with commit 5c1b5cee0b17336c348883da67f0b2c7c2564d89. |