ref #6925 Set conversation and cdmEntitySession to null for dispose
authorPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 22 Nov 2017 10:27:45 +0000 (11:27 +0100)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 22 Nov 2017 10:27:45 +0000 (11:27 +0100)
15 files changed:
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/e4/ReferencingObjectsViewE4.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/e4/CdmAuthorityEditorE4.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/PolytomousKeyListEditorE4.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/ChecklistEditorE4.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/CharacterEditor.java
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/AlignmentEditorE4.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/PolytomousKeyViewPartE4.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TaxonNavigatorE4.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/e4/SearchResultViewE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/CdmEntitySessionInput.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/DefinedTermEditorE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeEditor.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/AbstractNewEntityWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/EditFromSelectionWizard.java

index 79c7a2a2d80e689a8c8c301b6883d677853e1d44..8f470bee2842a2e611670c608f9892698dffbb7d 100644 (file)
@@ -461,6 +461,7 @@ public class ReferencingObjectsViewE4 extends AbstractCdmEditorPartE4 {
        public void dispose() {
            if(conversation!=null){
                conversation.close();
+               conversation = null;
            }
        }
 
index 1da16a4381b46448368a8ebfe443b02bc11d6ad9..27fed16dcb5927d18b536872a43801af8053396d 100644 (file)
@@ -137,6 +137,7 @@ public class CdmAuthorityEditorE4 implements IConversationEnabled, IDirtyMarkabl
            if(conversation!=null){
                conversation.unregisterForDataStoreChanges(this);
                conversation.close();
+               conversation = null;
            }
                if(input!=null){
                    input.getCdmEntitySession().dispose();
index 9cf7d0756ff759eeb158e362cf12c76531190748..ae1fc1dd0bb5f33e7eba560047f79e8faf753de6 100644 (file)
@@ -12,6 +12,7 @@ package eu.etaxonomy.taxeditor.editor.key.polytomous.e4;
 import java.util.List;
 
 import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
 import javax.inject.Inject;
 
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -240,6 +241,15 @@ public class PolytomousKeyListEditorE4 implements
         menuService.registerContextMenu(viewer.getControl(), "eu.etaxonomy.taxeditor.editor.popupmenu.polytomouskeylisteditor");
        }
 
+
+    @PreDestroy
+    public void dispose() {
+        if(input!=null){
+            input.dispose();
+            input.getConversationHolder().close();
+        }
+    }
+
        public int getTableItemCount() {
            if (viewer != null && viewer.getTable() != null) {
                return viewer.getTable().getItemCount();
index 2326a4cf9f59bdf86e3b4e5b972679def5d39cda..cea4e0270e5e179f61fc512cc7155c050960d457 100755 (executable)
@@ -765,9 +765,6 @@ public class ChecklistEditorE4 implements IPartContentHasFactualData, IConversat
      */
     @Override
     public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) {
-        conversation.clear();
-        conversation.close();
-        conversation = null;
     }
 
     private static final List<String> NODE_INIT_STRATEGY = Arrays.asList(new String[] { "descriptions", //$NON-NLS-1$
index b4c3f79c5eed2ea04a2f244c4f267a996062dc4a..b379345d31021db6bc724dde040648ea3696dca6 100644 (file)
@@ -496,9 +496,11 @@ public class DerivateView implements IPartContentHasFactualData, IConversationEn
     public void dispose() {
         if(conversation!=null){
             conversation.close();
+            conversation = null;
         }
         if(cdmEntitySession != null) {
             cdmEntitySession.dispose();
+            cdmEntitySession = null;
         }
     }
 
index c2c5dc2b37ac5b9f66f64ee7e7cdd69f6c62e0c2..a03c876666411517161f2dd4a95476b38f762cf5 100644 (file)
@@ -247,9 +247,11 @@ public class CharacterEditor
     public void dispose(){
         if(conversation!=null){
             conversation.close();
+            conversation = null;
         }
         if(cdmEntitySession != null) {
             cdmEntitySession.dispose();
+            cdmEntitySession = null;
         }
     }
 
index 35d38356fcec39d045afb649f01da5049e66f0d8..63fa5735833407e661c06075c741ed09047d7027 100644 (file)
@@ -376,12 +376,20 @@ public class AlignmentEditorE4 {
 
 
     @PreDestroy
-       public void dispose() {
-               Display.getCurrent().removeFilter(SWT.FocusIn, ACTION_UPDATER);
-               Display.getCurrent().removeFilter(SWT.FocusOut, ACTION_UPDATER);
-               CLIPBOARD.dispose();
+    public void dispose() {
+        Display.getCurrent().removeFilter(SWT.FocusIn, ACTION_UPDATER);
+        Display.getCurrent().removeFilter(SWT.FocusOut, ACTION_UPDATER);
+        CLIPBOARD.dispose();
         input.dispose();
-       }
+
+        if(conversationHolder!=null){
+            conversationHolder.close();
+            conversationHolder = null;
+        }
+        if(input!=null){
+            input.dispose();
+        }
+    }
 
 
        private void updateStatusBar() {
index 7daade5ad92c3d5bb45df4b91c5ad0a063d54d9e..40f425519b8bb7b39f2095f1e6ded9ae4b76cf86 100644 (file)
@@ -249,9 +249,11 @@ ICdmChangeListener {
             conversation.unregisterForDataStoreChanges(this);
             conversation.close();
             CdmStore.getContextManager().removeContextListener(contextListener);
+            conversation = null;
         }
         if(cdmEntitySession != null) {
             cdmEntitySession.dispose();
+            cdmEntitySession = null;
         }
         ICdmDataChangeService currentDataChangeService = CdmApplicationState.getCurrentDataChangeService();
         if(currentDataChangeService!=null){
index 3849745c5755a42bd3959cb244dcff68b3b7a36d..49f4ad0057f3581ba363d5cc4d1adfcd73d25c9e 100644 (file)
@@ -292,7 +292,7 @@ public class TaxonNavigatorE4 implements
            viewer.setInput(new EmptyRoot());
        }
 
-       public void restore(IMemento memento, IProgressMonitor monitor) {
+       private void restore(IMemento memento, IProgressMonitor monitor) {
            root = new Root(conversation);
                if (memento == null) {
                    viewer.setInput(root);
@@ -400,9 +400,11 @@ public class TaxonNavigatorE4 implements
                dataChangeBehavior = null;
                if (conversation != null) {
                        conversation.unregisterForDataStoreChanges(this);
+                       conversation = null;
                }
                if(cdmEntitySession != null) {
                    cdmEntitySession.dispose();
+                   cdmEntitySession = null;
                }
                if(CdmApplicationState.getCurrentDataChangeService() != null) {
                    CdmApplicationState.getCurrentDataChangeService().unregister(this);
index 720cf5bdd5a099ce920ce37581fe8fe698a50641..2921ed22b82d485fe85f33def885c4c1b2fad02c 100644 (file)
@@ -290,6 +290,7 @@ public class SearchResultViewE4 implements IConversationEnabled{
        public void dispose() {
                if(conversation!=null){
                    conversation.close();
+                   conversation = null;
                }
                if(searchJob != null) {
             searchJob.cancel();
index f05bf4ffb1a11387fc24e529ffcb402fea0c30aa..77cffd6c8d9984e861f836f48480105d91a9b6dc 100644 (file)
@@ -40,11 +40,14 @@ public abstract class CdmEntitySessionInput implements ICdmEntitySessionEnabled
     }
 
     public void bind() {
-        cdmEntitySession.bind();
+        if(cdmEntitySession!=null){
+            cdmEntitySession.bind();
+        }
     }
 
     public void dispose() {
         cdmEntitySession.dispose();
+        cdmEntitySession = null;
     }
 
     public abstract void merge();
index fcf5fa63f463ac9fde270d30f61de04f55769e39..ad965840928c1f19e8607ee396d6c27669bb29c6 100644 (file)
@@ -234,6 +234,7 @@ IPartContentHasDetails, IPartContentHasSupplementalData, IE4SavablePart, IContex
            if(conversation!=null){
                conversation.unregisterForDataStoreChanges(this);
                conversation.close();
+               conversation = null;
            }
            if(input!=null){
                input.dispose();
index a000baacfee39b24bda2617b119701d7078a52ba..3a3875357c55209187b17a5026080eb3b3d131c9 100644 (file)
@@ -209,9 +209,11 @@ public class FeatureTreeEditor implements ICdmEntitySessionEnabled, ModifyListen
        public void dispose(){
         if(conversation!=null){
             conversation.close();
+            conversation = null;
         }
         if(cdmEntitySession != null) {
             cdmEntitySession.dispose();
+            cdmEntitySession = null;
         }
        }
 
index 0f41b326693baaa312e96026f4a1840d58ce3978..5c733796e256671258caf430499fa764f61b7fae 100644 (file)
@@ -55,6 +55,7 @@ public abstract class AbstractNewEntityWizard<T> extends Wizard implements
 
                conversation.commit();
                conversation.close();
+               conversation = null;
                return true;
        }
 
index 88d9904ede29827fd1b8e7cd1343b70df0061abe..f830ee7adb2e7df9a0a322fe3cf23843e99e6bfe 100644 (file)
@@ -213,6 +213,7 @@ public class EditFromSelectionWizard extends Wizard implements
         super.dispose();
         if(cdmEntitySession != null) {
             cdmEntitySession.dispose();
+            cdmEntitySession = null;
         }
         if(previousCdmEntitySession!=null){
             previousCdmEntitySession.bind();