Browse Source

fixed race condition at startup

pull/468/head
orignal 9 years ago
parent
commit
0bf2abaa4c
  1. 9
      Signature.cpp

9
Signature.cpp

@ -435,8 +435,13 @@ namespace crypto
std::unique_ptr<Ed25519>& GetEd25519 () std::unique_ptr<Ed25519>& GetEd25519 ()
{ {
if (!g_Ed25519) if (!g_Ed25519)
g_Ed25519.reset (new Ed25519()); {
auto c = new Ed25519();
if (!g_Ed25519) // make sure it was not created already
g_Ed25519.reset (c);
else
delete c;
}
return g_Ed25519; return g_Ed25519;
} }

Loading…
Cancel
Save