]> git.sesse.net Git - casparcg/commitdiff
[AsyncEventServer] Avoid logging connection-close two times.
authorHelge Norberg <helge.norberg@svt.se>
Thu, 6 Apr 2017 09:34:30 +0000 (11:34 +0200)
committerHelge Norberg <helge.norberg@svt.se>
Thu, 6 Apr 2017 09:34:30 +0000 (11:34 +0200)
protocol/util/AsyncEventServer.cpp

index cdfe538345206bbf36b72a7f881c66b269bebd9c..4add2e7496ab967dc3ec2ac9c4066081f0036fd4 100644 (file)
@@ -157,8 +157,14 @@ public:
 
        void disconnect()
        {
-               auto self = shared_from_this();
-               service_->dispatch([=] { self->stop(); });
+               std::weak_ptr<connection> self = shared_from_this();
+               service_->dispatch([=]
+               {
+                       auto strong = self.lock();
+
+                       if (strong)
+                               strong->stop();
+               });
        }
 
        void add_lifecycle_bound_object(const std::wstring& key, const std::shared_ptr<void>& lifecycle_bound)