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

Bug 536807

Summary: Removing messages from MessageManager may throw Exception
Product: [RT] RAP Reporter: Chris Fairhall <chris>
Component: JFaceAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.2   
Target Milestone: 3.6 M1   
Hardware: PC   
OS: Windows NT   
See Also: https://git.eclipse.org/r/126304
https://git.eclipse.org/c/rap/org.eclipse.rap.git/commit/?id=2935893733f4f6f4a797b898c8be1e331b414a4c
Whiteboard:

Description Chris Fairhall CLA 2018-07-08 16:41:32 EDT
There is a functional difference between RCP and RAP where RAP may throw an exception if a MessageManager has its messages cleared.

Stack trace:
org.eclipse.swt.SWTException: Widget is disposed
	at org.eclipse.swt.SWT.error(SWT.java:3708) ~[org.eclipse.rap.rwt_3.2.0.20161006-0240.jar:?]
	at org.eclipse.swt.SWT.error(SWT.java:3631) ~[org.eclipse.rap.rwt_3.2.0.20161006-0240.jar:?]
	at org.eclipse.swt.SWT.error(SWT.java:3602) ~[org.eclipse.rap.rwt_3.2.0.20161006-0240.jar:?]
	at org.eclipse.swt.widgets.Widget.error(Widget.java:1018) ~[org.eclipse.rap.rwt_3.2.0.20161006-0240.jar:?]
	at org.eclipse.swt.widgets.Widget.getDisplay(Widget.java:397) ~[org.eclipse.rap.rwt_3.2.0.20161006-0240.jar:?]
	at org.eclipse.swt.widgets.Widget.isValidThread(Widget.java:972) ~[org.eclipse.rap.rwt_3.2.0.20161006-0240.jar:?]
	at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:955) ~[org.eclipse.rap.rwt_3.2.0.20161006-0240.jar:?]
	at org.eclipse.swt.internal.widgets.ControlDecorator.setText(ControlDecorator.java:71) ~[org.eclipse.rap.rwt_3.2.0.20161006-0240.jar:?]
	at org.eclipse.jface.fieldassist.ControlDecoration.setDescriptionText(ControlDecoration.java:922) ~[org.eclipse.rap.jface_3.2.0.20160811-0840.jar:?]
	at org.eclipse.ui.internal.forms.MessageManager$ControlDecorator.update(MessageManager.java:275) ~[org.eclipse.rap.ui.forms_3.2.0.20160811-0840.jar:?]
	at org.eclipse.ui.internal.forms.MessageManager$ControlDecorator.removeMessages(MessageManager.java:269) ~[org.eclipse.rap.ui.forms_3.2.0.20160811-0840.jar:?]
	at org.eclipse.ui.internal.forms.MessageManager.removeAllMessages(MessageManager.java:429) ~[org.eclipse.rap.ui.forms_3.2.0.20160811-0840.jar:?]

Differences between RAP and RCP that cause the issue

ControlDecoration:
  public void setDescriptionText(String text) {
//		this.descriptionText = text;
//		update();
	    // RAP [if]
	    decorator.setText( text );   // <<--- This does an isDisposed check via checkWidget() and throws an SWTException
	}


//	/**
//	 * Something has changed, requiring redraw. Redraw the decoration and update
//	 * the hover text if appropriate.
//	 */
//	protected void update() {
//		if (control == null || control.isDisposed()) { // <<----- Original RCP code checks for a disposed control and returns quietly (although in this case it's the decorated control being checked, not a new control acting as a decoration, which is a RAP specific implementation detail.
//			return;
//		}
...
Comment 1 Eclipse Genie CLA 2018-07-19 04:45:28 EDT
New Gerrit change created: https://git.eclipse.org/r/126304