Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornhauge2012-02-24 21:52:41 +0000
committernhauge2012-02-24 21:52:41 +0000
commit006fe52ebd80d3d17e631a725f8fe275bfe83631 (patch)
treeed1601fbae1ff8190ce0948259d7d911b101e475
parent86bb1d188931ae076bd304cf87befc6628bda2c8 (diff)
downloadwebtools.dali-006fe52ebd80d3d17e631a725f8fe275bfe83631.tar.gz
webtools.dali-006fe52ebd80d3d17e631a725f8fe275bfe83631.tar.xz
webtools.dali-006fe52ebd80d3d17e631a725f8fe275bfe83631.zip
366903 - fix leak in facet data model provider.
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProvider.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProvider.java
index 0d4ef5ff90..9c20df0ae4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProvider.java
@@ -70,6 +70,8 @@ public abstract class JpaFacetDataModelProvider
private LibraryInstallDelegate defaultLibraryProvider;
+ private IPropertyChangeListener libraryProviderListener;
+
/** cache the connection profile - change it whenever the user selects a different name */
private ConnectionProfile connectionProfile;
@@ -220,6 +222,7 @@ public abstract class JpaFacetDataModelProvider
this.defaultLibraryProvider = buildDefaultLibraryProvider();
}
else if (! this.defaultLibraryProvider.getProjectFacetVersion().equals(getProjectFacetVersion())) {
+ this.defaultLibraryProvider.removeListener(this.libraryProviderListener);
this.defaultLibraryProvider.dispose();
this.defaultLibraryProvider = buildDefaultLibraryProvider();
}
@@ -245,10 +248,11 @@ public abstract class JpaFacetDataModelProvider
JpaLibraryProviderInstallOperationConfig.JPA_PLATFORM_DESCRIPTION_ENABLEMENT_EXP, jpaPlatform);
LibraryInstallDelegate lp = new LibraryInstallDelegate(fpjwc, pfv, customEnablementVariables);
- lp.addListener(buildLibraryProviderListener());
+ this.libraryProviderListener = buildLibraryProviderListener();
+ lp.addListener(this.libraryProviderListener);
return lp;
}
-
+
protected IPropertyChangeListener buildLibraryProviderListener() {
return new IPropertyChangeListener() {
public void propertyChanged(String property, Object oldValue, Object newValue ) {
@@ -732,4 +736,12 @@ public abstract class JpaFacetDataModelProvider
protected static IStatus buildStatus(int severity, String message) {
return new Status(severity, JptJpaCorePlugin.PLUGIN_ID, message);
}
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ this.defaultLibraryProvider.removeListener(this.libraryProviderListener);
+ this.defaultLibraryProvider.dispose();
+ }
+
}

Back to the top