diff options
| author | pguilet | 2016-12-29 13:46:43 +0000 |
|---|---|---|
| committer | Pierre-Charles David | 2017-08-22 08:54:14 +0000 |
| commit | e9a585867ce24852f0d9473b614e8cefb5fd987e (patch) | |
| tree | ab9eadb58fb9bb1e78f1d159abe827d52f16cf24 | |
| parent | c1986648e599a9d692151969deebc9ec3d0391a1 (diff) | |
| download | org.eclipse.sirius-e9a585867ce24852f0d9473b614e8cefb5fd987e.tar.gz org.eclipse.sirius-e9a585867ce24852f0d9473b614e8cefb5fd987e.tar.xz org.eclipse.sirius-e9a585867ce24852f0d9473b614e8cefb5fd987e.zip | |
[509759] Fix potential memory leak when closing session
- Set the Saver's domain to null when closing session in case session is
kept in memory to avoid keeping the resource set inside in memory.
- Clear listener and lock object in AbstractPermissionAuthority when
disposing to avoid potential memory leak if those refers indirectly to
the resource set it is associated to in the cache weak hash map of the
registry
org.eclipse.sirius.ecore.extender.business.internal.permission.PermissionAuthorityRegistryImpl
Bug: 509759
Change-Id: I5bb1759792a84456489042aa70acff80784923ce
Signed-off-by: pguilet <pierre.guilet@obeo.fr>
2 files changed, 9 insertions, 15 deletions
diff --git a/plugins/org.eclipse.sirius.ecore.extender/src/org/eclipse/sirius/ecore/extender/business/internal/permission/AbstractPermissionAuthority.java b/plugins/org.eclipse.sirius.ecore.extender/src/org/eclipse/sirius/ecore/extender/business/internal/permission/AbstractPermissionAuthority.java index 82d1ee664c..cf26b48fc6 100644 --- a/plugins/org.eclipse.sirius.ecore.extender/src/org/eclipse/sirius/ecore/extender/business/internal/permission/AbstractPermissionAuthority.java +++ b/plugins/org.eclipse.sirius.ecore.extender/src/org/eclipse/sirius/ecore/extender/business/internal/permission/AbstractPermissionAuthority.java @@ -84,12 +84,8 @@ public abstract class AbstractPermissionAuthority implements IPermissionAuthorit @Override public void dispose(final ResourceSet set) { - if (set == null) { - listeners.clear(); - lockedObjects.clear(); - } else { - // we may clear the map - } + listeners.clear(); + lockedObjects.clear(); } @Override diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/danalysis/Saver.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/danalysis/Saver.java index ba7e048375..7d209a8c93 100644 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/danalysis/Saver.java +++ b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/danalysis/Saver.java @@ -31,11 +31,9 @@ import org.eclipse.sirius.viewpoint.Messages; import org.eclipse.sirius.viewpoint.SiriusPlugin; /** - * Encapsulates the decision of *when* to actually save the session's state when - * Session.save() is called. If Session.save() is called while a transaction is - * in progress and deferSaveToPostCommit is true, the actual saving will be - * performed after the current transaction has been successfully commited. - * Otherwise it is performed immediatly. + * Encapsulates the decision of *when* to actually save the session's state when Session.save() is called. If + * Session.save() is called while a transaction is in progress and deferSaveToPostCommit is true, the actual saving will + * be performed after the current transaction has been successfully commited. Otherwise it is performed immediatly. * * @author pcdavid */ @@ -75,8 +73,8 @@ final class Saver extends TransactionalEditingDomainListenerImpl { } /** - * Do saving after transaction closing in case the SavingPolicy trigger - * another transaction by executing a EMF Command. + * Do saving after transaction closing in case the SavingPolicy trigger another transaction by executing a EMF + * Command. */ @Override public void transactionClosed(TransactionalEditingDomainEvent event) { @@ -97,8 +95,7 @@ final class Saver extends TransactionalEditingDomainListenerImpl { } /** - * Arm the trigger so that the saving is performed after transaction - * closing. + * Arm the trigger so that the saving is performed after transaction closing. */ private void saveAfterTransactionClosing(Map<?, ?> options, IProgressMonitor monitor) { this.savedOptions = options; @@ -177,6 +174,7 @@ final class Saver extends TransactionalEditingDomainListenerImpl { lifecycle.removeTransactionalEditingDomainListener(this); } disarm(); + this.domain = null; } } |
