fix bug where project descriptor listeners could not be removed
authordadubrow
Wed, 10 Feb 2010 13:34:53 -0600
changeset 133 996f2f4e33c7
parent 131 6cbf17faf712
child 135 6f8730b7758d
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	Thu Jan 28 17:33:54 2010 -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:34:53 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){