Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concurrent modification exception fix (again, but different) #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/main/java/controlP5/ControllerGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Iterator;

import processing.core.PApplet;
import processing.core.PFont;
Expand Down Expand Up @@ -414,10 +415,13 @@ protected void drawControllers( PApplet theApplet , PGraphics theGraphics ) {
cc.draw( theGraphics );
}
}
for ( ControllerInterface< ? > ci : controllers.get( ) ) {
if ( ci.isVisible( ) ) {
ci.updateInternalEvents( theApplet );
ci.draw( theGraphics );

Iterator<ControllerInterface<?>> iterator = controllers.get().iterator();
while (iterator.hasNext()) {
ControllerInterface<?> ci = iterator.next();
if (ci.isVisible()) {
ci.updateInternalEvents(theApplet);
ci.draw(theGraphics);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/controlP5/ControllerList.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/

import java.util.List;
import java.util.Vector;
import java.util.ArrayList;

/**
* Stores objects of type ControllerInterface and CDrawable, mainly for internal use.
Expand All @@ -38,8 +38,8 @@ public class ControllerList {
protected List< CDrawable > drawables;

public ControllerList( ) {
controllers = new Vector< ControllerInterface< ? >>( );
drawables = new Vector< CDrawable >( );
controllers = new ArrayList< ControllerInterface< ? >>( );
drawables = new ArrayList< CDrawable >( );
}

public void add( ControllerInterface< ? > theController ) {
Expand Down