diff options
author | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2020-01-22 18:29:01 +0200 |
---|---|---|
committer | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2020-01-23 12:55:57 +0300 |
commit | 84b0b35f6dcea1c42d6586d7058b980685f19599 (patch) | |
tree | 80569910167b0e0ee3c74938b6c6d6cfff4a2175 /include/mbgl | |
parent | 7bf4de9f39dbc058cc61f5a979bcd30bc1be6761 (diff) | |
download | qtlocation-mapboxgl-84b0b35f6dcea1c42d6586d7058b980685f19599.tar.gz |
[core] Use weak scheduler inside mailbox
There is no guarantee that scheduler is alive when message
is pushed to the mailbox.
Diffstat (limited to 'include/mbgl')
-rw-r--r-- | include/mbgl/actor/mailbox.hpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/mbgl/actor/mailbox.hpp b/include/mbgl/actor/mailbox.hpp index 2b9838ef29..1e18d593d3 100644 --- a/include/mbgl/actor/mailbox.hpp +++ b/include/mbgl/actor/mailbox.hpp @@ -7,6 +7,8 @@ #include <mutex> #include <queue> +#include <mapbox/weak.hpp> + namespace mbgl { class Scheduler; @@ -38,7 +40,7 @@ public: static std::function<void()> makeClosure(std::weak_ptr<Mailbox>); private: - optional<Scheduler*> scheduler; + mapbox::base::WeakPtr<Scheduler> weakScheduler; std::recursive_mutex receivingMutex; std::mutex pushingMutex; |