Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas FAUVERGUE2016-06-03 03:24:39 -0400
committerNicolas FAUVERGUE2016-06-13 10:20:37 -0400
commit8aa8b0876b4851fdba5221f12b19e728904747d5 (patch)
tree9c9f7acee8085e24adde05a2d690e27a0b699d18
parent6070293ff87b6a05214a3fff2c9676da40d7556f (diff)
downloadorg.eclipse.papyrus-8aa8b0876b4851fdba5221f12b19e728904747d5.tar.gz
org.eclipse.papyrus-8aa8b0876b4851fdba5221f12b19e728904747d5.tar.xz
org.eclipse.papyrus-8aa8b0876b4851fdba5221f12b19e728904747d5.zip
Bug 490067: [Table - Properties] Exception when deleting an element
while a Table is displayed in the properties view https://bugs.eclipse.org/bugs/show_bug.cgi?id=490067 Manage the decoration service as global variable to avoid possible memory leak. Change-Id: I921427254b46e708d78382a8631d3c1c5bc50c9b Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@all4tec.net>
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java28
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java5
2 files changed, 21 insertions, 12 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java
index fb40f2c47aa..21d5317b8c7 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java
@@ -275,6 +275,11 @@ public abstract class AbstractNattableWidgetManager implements INattableModelMan
* the cell editor axis configuration
*/
private CellEditorAxisConfiguration cellAxisConfiguration;
+
+ /**
+ * Keep the decoration service as variable to avoid possible memory leak.
+ */
+ protected DecorationService decorationService;
/**
* The table popup menu configuration.
@@ -650,17 +655,19 @@ public abstract class AbstractNattableWidgetManager implements INattableModelMan
* the decoration service
*/
protected DecorationService getDecorationService() {
- // Bug 490067: We need to check if the resource of the context is existing before to get the decoration service (to avoid useless log exception)
- // The resource of the context is not existing in the case of deletion (EObject was already deleted but the reference of table always exists)
- if (null != this.table.getContext().eResource()) {
- try {
- ServicesRegistry serviceRegistry = ServiceUtilsForEObject.getInstance().getServiceRegistry(this.table.getContext());// get context and NOT get table for the usecase where the table is not in a resource
- return serviceRegistry.getService(DecorationService.class);
- } catch (ServiceException e) {
- Activator.log.error(e);
+ if(null == decorationService){
+ // Bug 490067: We need to check if the resource of the context is existing before to get the decoration service (to avoid useless log exception)
+ // The resource of the context is not existing in the case of deletion (EObject was already deleted but the reference of table always exists)
+ if (null != this.table.getContext().eResource()) {
+ try {
+ ServicesRegistry serviceRegistry = ServiceUtilsForEObject.getInstance().getServiceRegistry(this.table.getContext());// get context and NOT get table for the usecase where the table is not in a resource
+ return serviceRegistry.getService(DecorationService.class);
+ } catch (ServiceException e) {
+ Activator.log.error(e);
+ }
}
}
- return null;
+ return decorationService;
}
/**
@@ -1331,6 +1338,9 @@ public abstract class AbstractNattableWidgetManager implements INattableModelMan
if (this.filterStrategy instanceof IDisposable) {
((IDisposable) this.filterStrategy).dispose();
}
+ if(null != this.decorationService){
+ this.decorationService = null;
+ }
this.cellAxisConfiguration = null;
this.filterConfiguration = null;
this.tableEditingDomain = null;
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
index ea7d51ca73c..b733b0de9ce 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
@@ -816,9 +816,8 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
public void dispose() {
if (this.decoractionServiceObserver != null) {
// Bug 490067: Check if the decoration service is available to avoid null pointer
- final DecorationService decorationService = getDecorationService();
- if (null != decorationService) {
- decorationService.deleteListener(this.decoractionServiceObserver);
+ if (null != this.decorationService) {
+ this.decorationService.deleteListener(this.decoractionServiceObserver);
}
this.decoractionServiceObserver = null;
}

Back to the top