diff options
-rw-r--r-- | opentrack/options.hpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/opentrack/options.hpp b/opentrack/options.hpp index 5eae754f..35b1640e 100644 --- a/opentrack/options.hpp +++ b/opentrack/options.hpp @@ -224,7 +224,7 @@ namespace options { { public: using pbundle = std::shared_ptr<v>; - using tt = std::tuple<cnt, pbundle>; + using tt = std::tuple<cnt, std::weak_ptr<v>>; private: QMutex implsgl_mtx; map<k, tt> implsgl_data; @@ -242,7 +242,11 @@ namespace options { QMutexLocker l(&implsgl_mtx); if (implsgl_data.count(key) != 0) - return std::get<1>(implsgl_data[key]); + { + auto shared = std::get<1>(implsgl_data[key]).lock(); + if (shared != nullptr) + return shared; + } qDebug() << "bundle +" << QString::fromStdString(key); |