From 4d5928fcc07f1943cec6e12217a4fdd02b0c9ae9 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 30 Nov 2019 19:45:43 +0100 Subject: [PATCH] fixed a potential crash caused by reentrant hybrid::link --- nonisotropic.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nonisotropic.cpp b/nonisotropic.cpp index 497a5c73..ec5c761a 100644 --- a/nonisotropic.cpp +++ b/nonisotropic.cpp @@ -1216,7 +1216,11 @@ EX namespace hybrid { EX void will_link(cell *c) { if(pmap && ((hrmap_hybrid*) pmap)->twisted) to_link.push_back(c); } + EX bool in_link = false; + EX void link() { + if(in_link) return; + dynamicval b(in_link, true); auto pm = (hrmap_hybrid*) pmap; if(!pm) return; auto& ss = pm->spins;