Project

General

Profile

« Previous | Next » 

Revision 452f8632

Added by Leszek Koltunski almost 8 years ago

Bugfix: only add EffectListener ONCE!

View differences:

src/main/java/org/distorted/library/EffectQueue.java
121 121
  void addListener(EffectListener el)
122 122
    {
123 123
    if( mListeners==null ) mListeners = new Vector<>(2,2);
124
   
125
    mListeners.add(el);
126
    mNumListeners++;
124

  
125
    if( !mListeners.contains(el) )
126
      {
127
      mListeners.add(el);
128
      mNumListeners++;
129
      }
127 130
    }
128 131
 
129 132
///////////////////////////////////////////////////////////////////////////////////////////////////
130 133

  
131 134
  void removeListener(EffectListener el)
132 135
    {
133
    if( mNumListeners>0 )  
136
    if( mListeners.remove(el) )
134 137
      {
135
      mListeners.remove(el);
136 138
      mNumListeners--;
137 139
      }
138 140
    }

Also available in: Unified diff