From: Marko Luukkainen Date: Tue, 28 Dec 2021 11:52:39 +0000 (+0200) Subject: Reduce memory leaks caused by query cache referring to disposed UI X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F13%2F4813%2F2;p=simantics%2Fplatform.git Reduce memory leaks caused by query cache referring to disposed UI components gitlab #789 Change-Id: If2092924c8be66795d35d52a2e6a0fa510d5f2d2 --- diff --git a/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/NatTableGraphExplorer.java b/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/NatTableGraphExplorer.java index 9d12fd9b5..c05b3b408 100644 --- a/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/NatTableGraphExplorer.java +++ b/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/NatTableGraphExplorer.java @@ -1044,10 +1044,12 @@ public class NatTableGraphExplorer extends GraphExplorerImplBase implements Grap columns = null; columnKeyToIndex.clear(); columnKeyToIndex = null; +// Disposing NatTable here causes SWT isDisposed exception when GraphExplorer composite disposes DragSource. // if (natTable != null) { // natTable.dispose(); // natTable = null; // } + natTable = null; treeLayer = null; dataLayer = null; viewportLayer = null; diff --git a/bundles/org.simantics.selectionview/src/org/simantics/selectionview/PropertyPage.java b/bundles/org.simantics.selectionview/src/org/simantics/selectionview/PropertyPage.java index eb4caaeba..0f700d1d3 100644 --- a/bundles/org.simantics.selectionview/src/org/simantics/selectionview/PropertyPage.java +++ b/bundles/org.simantics.selectionview/src/org/simantics/selectionview/PropertyPage.java @@ -125,6 +125,7 @@ public class PropertyPage extends AbstractPropertyPage implements IPropertyPage, super.dispose(); tab = null; sessionContext = null; + propertyPageView = null; } protected ISessionContextProvider getSessionContextProvider() { diff --git a/bundles/org.simantics.selectionview/src/org/simantics/selectionview/StandardPropertyPage.java b/bundles/org.simantics.selectionview/src/org/simantics/selectionview/StandardPropertyPage.java index f0b618f6e..6229cd3f4 100644 --- a/bundles/org.simantics.selectionview/src/org/simantics/selectionview/StandardPropertyPage.java +++ b/bundles/org.simantics.selectionview/src/org/simantics/selectionview/StandardPropertyPage.java @@ -91,6 +91,12 @@ public class StandardPropertyPage extends PropertyPage { protected Set getContexts() { return contexts; } + + @Override + public void dispose() { + super.dispose(); + tabs = null; + } @SuppressWarnings("unchecked") @Override