security: Create PIB implementation as shared_ptr
While existing code is valid, it caused strange crashes on Android/ARM
platform.
Change-Id: I29c4879c65b3c844abb2d75f267c44a0b959a6f7
diff --git a/ndn-cxx/security/v2/key-chain.hpp b/ndn-cxx/security/v2/key-chain.hpp
index 1524a1b..bbfd3ab 100644
--- a/ndn-cxx/security/v2/key-chain.hpp
+++ b/ndn-cxx/security/v2/key-chain.hpp
@@ -367,7 +367,7 @@
registerTpmBackend(const std::string& scheme);
private:
- typedef std::map<std::string, function<unique_ptr<pib::PibImpl>(const std::string& location)>> PibFactories;
+ typedef std::map<std::string, function<std::shared_ptr<pib::PibImpl>(const std::string& location)>> PibFactories;
typedef std::map<std::string, function<unique_ptr<tpm::BackEnd>(const std::string& location)>> TpmFactories;
static PibFactories&
@@ -458,7 +458,7 @@
KeyChain::registerPibBackend(const std::string& scheme)
{
getPibFactories().emplace(scheme, [] (const std::string& locator) {
- return unique_ptr<pib::PibImpl>(new PibType(locator));
+ return std::shared_ptr<pib::PibImpl>(new PibType(locator));
});
}