Skip to content

Commit

Permalink
Fix unreleased locks
Browse files Browse the repository at this point in the history
  • Loading branch information
eduramiba committed Aug 3, 2017
1 parent 9ab746d commit 2a33cfb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Development and Distribution License("CDDL") (collectively, the
import java.util.Map;
import org.gephi.graph.api.DirectedGraph;
import org.gephi.graph.api.Edge;
import org.gephi.graph.api.EdgeIterable;
import org.gephi.graph.api.Node;

/**
Expand Down Expand Up @@ -92,8 +93,10 @@ public void compute() {
}

//Check for negative-weight cycles
for (Edge edge : graph.getEdges()) {
EdgeIterable edgesIterable = graph.getEdges();
for (Edge edge : edgesIterable) {
if (distances.get(edge.getSource()) + edgeWeight(edge) < distances.get(edge.getTarget())) {
edgesIterable.doBreak();
throw new RuntimeException("The Graph contains a negative-weighted cycle");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,13 @@ private void saveAsEdgeList1(boolean useLabels, Graph graph) throws IOException
writer.write("labels embedded:\n");
writer.write("data:\n");

Iterator<Edge> edgeIterator = graph.getEdges().iterator();
while (edgeIterator.hasNext()) {
EdgeIterable edgesIterable = graph.getEdges();
for (Edge edge : edgesIterable) {
if (cancel) {
edgesIterable.doBreak();
break;
}
Edge edge = edgeIterator.next();

double weight = edge.getWeight(graph.getView());

if (useLabels) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ private void writeEdges(XMLStreamWriter xmlWriter, Graph graph) throws Exception
xmlWriter.writeEndElement();
Progress.progress(progress);
if (cancel) {
edgeIterable.doBreak();
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Development and Distribution License("CDDL") (collectively, the
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.gephi.graph.api.NodeIterable;
import org.openide.util.Exceptions;

/**
Expand Down Expand Up @@ -168,7 +169,8 @@ public void goAlgo() {

// Proximities are built !
// Apply repulsion force - along proximities...
for (Node n1 : graph.getNodes()) {
NodeIterable nodesIterable = graph.getNodes();
for (Node n1 : nodesIterable) {
NoverlapLayoutData lald = n1.getLayoutData();
for (Node n2 : lald.neighbours) {
float n1x = n1.x();
Expand Down Expand Up @@ -202,6 +204,7 @@ public void goAlgo() {
}
}
if (cancel) {
nodesIterable.doBreak();
break;
}
}
Expand Down

0 comments on commit 2a33cfb

Please sign in to comment.