From e1031288ff9e09fa4710ed7bdedecbb611c37a11 Mon Sep 17 00:00:00 2001 From: Marko Luukkainen Date: Tue, 28 Dec 2021 13:52:39 +0200 Subject: [PATCH] Reduce memory leaks caused by query cache referring to disposed UI components gitlab #789 Change-Id: If2092924c8be66795d35d52a2e6a0fa510d5f2d2 --- .../browsing/ui/nattable/NatTableGraphExplorer.java | 2 ++ .../src/org/simantics/selectionview/PropertyPage.java | 1 + .../org/simantics/selectionview/StandardPropertyPage.java | 6 ++++++ 3 files changed, 9 insertions(+) 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 -- 2.47.1