Community
Participate
Working Groups
When adding listeners to AbstractSourceProvider, it stores the listeners in an array. removeSourceProviderListener removes a listener from its position in the array and compacts the array but the compacting algorithm results in an extra copy of the last listener in the array. Example: Let's say there are two listeners A and B. 1. The listener array will be [A,B,null,null,null,null,null] and listenerCount will be 2. 2. Now someone calls removeSourceProviderListener(A). The compacting algorithm will result in the following listener array [B,B,null,null,null,null,null]. listenerCount will be set to 1. 3. Now someone calls removeSourceProviderListener(B). This will result in the following listener array [null,B,null,null,null,null,null]. Note that the array still refers to B even though we requested the listener to be removed.
Great find!
Pushed proposed fix & unit test to Gerrit: https://git.eclipse.org/r/11729
Released as http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=b0108276bfffc14e39f8a3f63cf42f0dc2b9e75f Thanks Paul PW
Verified in 4.3.0.I20130430-0031