summaryrefslogtreecommitdiffhomepage
path: root/options/bundle.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-02-27 10:55:37 +0100
committerStanislaw Halik <sthalik@misaki.pl>2017-02-27 10:55:37 +0100
commit1b01642dda7ae8bbf3e74a979ffcf7941a8ae2b9 (patch)
tree8245eb2a18183181ee766384c3a4e43cec559e34 /options/bundle.hpp
parent99ab4eb8e64bdc7abe0a8751ada04342f21884f2 (diff)
options/fix bundle refcount handling
We rolled up our own refcount while using shared_ptr at the same time. Remove all rolled-up logic and rely on shared_ptr's custom deleter to do the cleanups. This greatly simplifies the code here. Unfortunately, _fini ordering makes Qt crash after the app object runs out of scope: gui/main.cpp: QApplication app(argc, argv); Both things considered, use _exit(2) on Unix to avoid running static destructors.
Diffstat (limited to 'options/bundle.hpp')
-rw-r--r--options/bundle.hpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/options/bundle.hpp b/options/bundle.hpp
index 3d952928..c8050ec7 100644
--- a/options/bundle.hpp
+++ b/options/bundle.hpp
@@ -81,22 +81,23 @@ public:
}
};
+OPENTRACK_OPTIONS_EXPORT bundler& singleton();
+
struct OPENTRACK_OPTIONS_EXPORT bundler
{
public:
using k = QString;
using v = bundle;
- using cnt = int;
- using tt = std::tuple<cnt, std::weak_ptr<v>>;
+ using weak = std::weak_ptr<v>;
+ using shared = std::shared_ptr<v>;
private:
QMutex implsgl_mtx;
- std::map<k, tt> implsgl_data;
+ std::map<k, weak> implsgl_data;
void after_profile_changed_();
public:
bundler();
~bundler();
std::shared_ptr<v> make_bundle(const k& key);
- void bundle_decf(const k& key);
static void refresh_all_bundles();
};