mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 12:35:22 +02:00
[282634] [dstore] IndexOutOfBoundsException on Disconnect
This commit is contained in:
parent
43c322c167
commit
2d57b79f85
1 changed files with 22 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2002, 2008 IBM Corporation and others.
|
* Copyright (c) 2002, 2009 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* {Name} (company) - description of contribution.
|
* David McKnight (IBM) - [282634] [dstore] IndexOutOfBoundsException on Disconnect
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.dstore.internal.extra;
|
package org.eclipse.dstore.internal.extra;
|
||||||
|
@ -51,20 +51,28 @@ public class DomainNotifier implements IDomainNotifier
|
||||||
|
|
||||||
public void addDomainListener(IDomainListener listener)
|
public void addDomainListener(IDomainListener listener)
|
||||||
{
|
{
|
||||||
|
synchronized (_listeners){
|
||||||
if (!_listeners.contains(listener))
|
if (!_listeners.contains(listener))
|
||||||
{
|
{
|
||||||
_listeners.add(listener);
|
_listeners.add(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void fireDomainChanged(DomainEvent event)
|
public void fireDomainChanged(DomainEvent event)
|
||||||
{
|
{
|
||||||
if (_enabled)
|
if (_enabled)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _listeners.size(); i++)
|
Object[] listeners = null;
|
||||||
|
|
||||||
|
synchronized (_listeners){
|
||||||
|
listeners = _listeners.toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < listeners.length; i++)
|
||||||
{
|
{
|
||||||
IDomainListener listener = (IDomainListener) _listeners.get(i);
|
IDomainListener listener = (IDomainListener)listeners[i];
|
||||||
if ((listener != null) && listener.listeningTo(event))
|
if ((listener != null) && listener.listeningTo(event))
|
||||||
{
|
{
|
||||||
listener.domainChanged(event);
|
listener.domainChanged(event);
|
||||||
|
@ -75,11 +83,15 @@ public class DomainNotifier implements IDomainNotifier
|
||||||
|
|
||||||
public boolean hasDomainListener(IDomainListener listener)
|
public boolean hasDomainListener(IDomainListener listener)
|
||||||
{
|
{
|
||||||
|
synchronized (_listeners){
|
||||||
return _listeners.contains(listener);
|
return _listeners.contains(listener);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void removeDomainListener(IDomainListener listener)
|
public void removeDomainListener(IDomainListener listener)
|
||||||
{
|
{
|
||||||
|
synchronized (_listeners){
|
||||||
_listeners.remove(listener);
|
_listeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue