diff options
| author | Laurent Redor | 2014-12-11 09:46:08 +0000 |
|---|---|---|
| committer | Laurent Redor | 2014-12-11 09:46:08 +0000 |
| commit | 9c70c327f2de38dae9e62d24644024696e11af5b (patch) | |
| tree | d7ca4e1849c56fac57732ca466652e680cfd4087 | |
| parent | 93e9745399afe74fe7f8e8c4313243df585a058a (diff) | |
| download | org.eclipse.sirius-9c70c327f2de38dae9e62d24644024696e11af5b.tar.gz org.eclipse.sirius-9c70c327f2de38dae9e62d24644024696e11af5b.tar.xz org.eclipse.sirius-9c70c327f2de38dae9e62d24644024696e11af5b.zip | |
[cleanup] Set session to null after SaveSessionJob execution
After a memory analysis, we have noticed that several AirDResourceImpl
are retained by DAnalysisSessionImpl, that themselves are retained by
SaveSessionJob. The job can indeed, be retained by ProgressManager.
The session is now reset to null after the job execution. Even if Job is
supposed to be reusable (see Javadoc of Job), the SaveSessionJob do
nothing if it is reused.
Change-Id: Ic9971c486e80d54ba185c69895bf926453d1f692
Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
| -rw-r--r-- | plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/danalysis/SaveSessionJob.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/danalysis/SaveSessionJob.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/danalysis/SaveSessionJob.java index 6d9c7b5e8c..fae8362961 100644 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/danalysis/SaveSessionJob.java +++ b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/danalysis/SaveSessionJob.java @@ -49,7 +49,7 @@ public class SaveSessionJob extends Job { public IStatus run(IProgressMonitor monitor) { try { monitor.beginTask(ACTION_NAME, IProgressMonitor.UNKNOWN); - if (session.isOpen() && SessionStatus.DIRTY == session.getStatus()) { + if (session != null && session.isOpen() && SessionStatus.DIRTY == session.getStatus()) { if (session instanceof DAnalysisSessionImpl) { /* * We can never know when the job will be scheduled, and it @@ -75,6 +75,9 @@ public class SaveSessionJob extends Job { } } finally { monitor.done(); + // Set the session to null to avoid a leak. The job is potentially + // kept by the ProgressManager. + session = null; } return Status.OK_STATUS; } |
