Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStéphane Bégaudeau2017-01-27 08:55:05 +0000
committerStéphane Bégaudeau2017-01-27 08:58:21 +0000
commit102fc7b8d586063db726774e693df38a49cb7b40 (patch)
tree49cf5edc2c526f0f79d873bad30bf56d7fca0c49
parent32ca1c302e100adde867587f6f1b6c859b8f98b8 (diff)
downloadorg.eclipse.eef-102fc7b8d586063db726774e693df38a49cb7b40.tar.gz
org.eclipse.eef-102fc7b8d586063db726774e693df38a49cb7b40.tar.xz
org.eclipse.eef-102fc7b8d586063db726774e693df38a49cb7b40.zip
[510279] Fix potential NPE in AbstractEEFWidgetLifecycleManagerv1.9.0_RC5v1.9.0
AbstractEEFWidgetLifecycleManager.lockedBy* are called asynchronously and sometimes this can occur at a time when the ControlDecoration has been disposed, causing NPEs in ControlDecoration.setImage() when it accesses control.getShell(). ControlDecoration does not have an isDisposed() method, but testing for getControl() != null is equivalent. Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=510279 Change-Id: Icf155151eacbdbf50db4161955222f566dadf70e Signed-off-by: Stéphane Bégaudeau <stephane.begaudeau@obeo.fr>
-rw-r--r--plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/api/widgets/AbstractEEFWidgetLifecycleManager.java30
1 files changed, 18 insertions, 12 deletions
diff --git a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/api/widgets/AbstractEEFWidgetLifecycleManager.java b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/api/widgets/AbstractEEFWidgetLifecycleManager.java
index e56f7938c..01b1c3eb2 100644
--- a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/api/widgets/AbstractEEFWidgetLifecycleManager.java
+++ b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/api/widgets/AbstractEEFWidgetLifecycleManager.java
@@ -343,7 +343,7 @@ public abstract class AbstractEEFWidgetLifecycleManager extends AbstractEEFLifec
/**
* Handles the change in the lock status by switching the user interface to a "locked by me", "locked by other" or
* "unlocked" state.
- *
+ *
* @param status
* The lock status
*/
@@ -381,10 +381,12 @@ public abstract class AbstractEEFWidgetLifecycleManager extends AbstractEEFLifec
* validation control.
*/
protected void lockedByMe() {
- this.controlDecoration.hide();
- this.controlDecoration.setDescriptionText(Messages.AbstractEEFWidgetLifecycleManager_lockedByMe);
- this.controlDecoration.setImage(EEFIdeUiPlugin.getPlugin().getImageRegistry().get(Icons.PERMISSION_GRANTED_TO_CURRENT_USER_EXCLUSIVELY));
- this.controlDecoration.show();
+ if (this.controlDecoration.getControl() != null) {
+ this.controlDecoration.hide();
+ this.controlDecoration.setDescriptionText(Messages.AbstractEEFWidgetLifecycleManager_lockedByMe);
+ this.controlDecoration.setImage(EEFIdeUiPlugin.getPlugin().getImageRegistry().get(Icons.PERMISSION_GRANTED_TO_CURRENT_USER_EXCLUSIVELY));
+ this.controlDecoration.show();
+ }
}
/**
@@ -395,20 +397,24 @@ public abstract class AbstractEEFWidgetLifecycleManager extends AbstractEEFLifec
protected void lockedByOther() {
this.setEnabled(false);
- this.controlDecoration.hide();
- this.controlDecoration.setDescriptionText(Messages.AbstractEEFWidgetLifecycleManager_lockedByOther);
- this.controlDecoration.setImage(EEFIdeUiPlugin.getPlugin().getImageRegistry().get(Icons.PERMISSION_DENIED));
- this.controlDecoration.show();
+ if (this.controlDecoration.getControl() != null) {
+ this.controlDecoration.hide();
+ this.controlDecoration.setDescriptionText(Messages.AbstractEEFWidgetLifecycleManager_lockedByOther);
+ this.controlDecoration.setImage(EEFIdeUiPlugin.getPlugin().getImageRegistry().get(Icons.PERMISSION_DENIED));
+ this.controlDecoration.show();
+ }
}
/**
- * Sets the appearance and behavior of the widget in order to indicate that the semantic element used by the widget is
- * currently unlocked. As a result, it will set back the widget to its default state.
+ * Sets the appearance and behavior of the widget in order to indicate that the semantic element used by the widget
+ * is currently unlocked. As a result, it will set back the widget to its default state.
*/
protected void unlocked() {
this.setEnabled(this.isEnabled());
- this.controlDecoration.hide();
+ if (this.controlDecoration.getControl() != null) {
+ this.controlDecoration.hide();
+ }
}
/**

Back to the top