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

Bug 339342

Summary: CTabFolder should throw IllegalArgumentException when a disposed control is set as its top right control
Product: [Eclipse Project] Platform Reporter: Remy Suen <remy.suen>
Component: SWTAssignee: Carolyn MacLeod <carolynmacleod4>
Status: RESOLVED FIXED QA Contact: Bogdan Gheorghe <gheorghe>
Severity: normal    
Priority: P3 CC: carolynmacleod4, Silenio_Quarti
Version: 3.7   
Target Milestone: 4.3 M1   
Hardware: All   
OS: All   
Whiteboard:

Description Remy Suen CLA 2011-03-09 07:41:01 EST
The setDefaultButton(Button) method from Decorations will throw an IllegalArgumentException when a disposed button is set, why doesn't CTabFolder's setTopRight(Control) method do the same?

Display display = new Display();
Shell shell = new Shell(display, SWT.SHELL_TRIM);
shell.setLayout(new FillLayout());

CTabFolder folder = new CTabFolder(shell, SWT.CLOSE);
Composite c = new Composite(folder, SWT.NONE);
c.dispose();
folder.setTopRight(c);

shell.open();

while (!shell.isDisposed()) {
  if (!display.readAndDispatch())
    display.sleep();
}
display.dispose();