Skip to content

Commit 0e52fa9

Browse files
committed
Critical bug, in some cases the firstBondVector get's passed down to the AtomPlacer where it is modified. Since we used a static default there was a race condition generating malformed coordinates.
1 parent e6686ab commit 0e52fa9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tool/sdg/src/main/java/org/openscience/cdk/layout/StructureDiagramGenerator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,10 @@ public void generateCoordinates(Vector2d firstBondVector) throws CDKException {
604604
*/
605605
private void generateCoordinates(Vector2d firstBondVector, boolean isConnected, boolean isSubLayout) throws CDKException {
606606

607+
// defensive copy, vectors are mutable!
608+
if (firstBondVector == DEFAULT_BOND_VECTOR)
609+
firstBondVector = new Vector2d(firstBondVector);
610+
607611
final int numAtoms = molecule.getAtomCount();
608612
final int numBonds = molecule.getBondCount();
609613
this.firstBondVector = firstBondVector;

0 commit comments

Comments
 (0)