fix bug where project descriptor listeners could not be removed RCL_2_4
authordadubrow
Wed, 10 Feb 2010 13:31:11 -0600
branchRCL_2_4
changeset 132 3720b50bf185
parent 128 d00b6e7a8c94
child 134 e4dfdbcc0926
child 138 e0657161c0cc
fix bug where project descriptor listeners could not be removed
cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java	Tue Dec 15 14:30:07 2009 -0600
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java	Wed Feb 10 13:31:11 2010 -0600
@@ -231,14 +231,16 @@
 		public boolean handlesEvent(int eventType){
 			return (eventType & fEventTypes) != 0;
 		}
-		@Override
-		public int hashCode() {
-			return fListener.hashCode();
-		}
-		@Override
-		public boolean equals(Object obj) {
-			return fListener.equals(obj);
-		}
+		
+		// Can't use these due to implementation of CopyOnWriteArraySet.remove()
+//		@Override
+//		public int hashCode() {
+//			return fListener.hashCode();
+//		}
+//		@Override
+//		public boolean equals(Object obj) {
+//			return fListener.equals(obj);
+//		}
 	}
 
 	private volatile Map<String, CConfigurationDataProviderDescriptor> fProviderMap;
@@ -2088,7 +2090,14 @@
 	}
 
 	public void removeCProjectDescriptionListener(ICProjectDescriptionListener listener) {
-		fListeners.remove(listener);
+//		fListeners.remove(listener);
+//		Note: can't use remove directly due to the implementation of CopyOnWriteArraySet.remove()
+		for (ListenerDescriptor listenerDescriptor : fListeners) {
+			if (listenerDescriptor.fListener.equals(listener)) {
+				fListeners.remove(listenerDescriptor);
+				break;
+			}
+		}
 	}
 
 	public void notifyListeners(CProjectDescriptionEvent event){