From c1c9b3d74e17d8e5793c9b87e211a30d71245e93 Mon Sep 17 00:00:00 2001
From: Rider Linden <rider@lindenlab.com>
Date: Mon, 11 Jul 2016 16:33:11 -0700
Subject: [PATCH] MAINT-6565: Grab a shared pointer and encapsulate it into the
 bind call in place of this. Ensures that the impl is not deleted while the
 coroutine is active.

---
 indra/newview/lleventpoll.cpp | 7 +++----
 indra/newview/lleventpoll.h   | 2 +-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/indra/newview/lleventpoll.cpp b/indra/newview/lleventpoll.cpp
index 7178042b326..51967d54a05 100644
--- a/indra/newview/lleventpoll.cpp
+++ b/indra/newview/lleventpoll.cpp
@@ -45,7 +45,7 @@ namespace LLEventPolling
 namespace Details
 {
 
-    class LLEventPollImpl
+    class LLEventPollImpl: public boost::enable_shared_from_this<LLEventPollImpl>
     {
     public:
         LLEventPollImpl(const LLHost &sender);
@@ -113,7 +113,7 @@ namespace Details
         {
             std::string coroname =
                 LLCoros::instance().launch("LLEventPollImpl::eventPollCoro",
-                boost::bind(&LLEventPollImpl::eventPollCoro, this, url));
+                boost::bind(&LLEventPollImpl::eventPollCoro, this->shared_from_this(), url));
             LL_INFOS("LLEventPollImpl") << coroname << " with  url '" << url << LL_ENDL;
         }
     }
@@ -273,8 +273,7 @@ namespace Details
 LLEventPoll::LLEventPoll(const std::string&	poll_url, const LLHost& sender):
     mImpl()
 { 
-    mImpl = boost::unique_ptr<LLEventPolling::Details::LLEventPollImpl>
-            (new LLEventPolling::Details::LLEventPollImpl(sender));
+    mImpl = boost::shared_ptr<LLEventPolling::Details::LLEventPollImpl>(new LLEventPolling::Details::LLEventPollImpl(sender));
     mImpl->start(poll_url);
 }
 
diff --git a/indra/newview/lleventpoll.h b/indra/newview/lleventpoll.h
index e2afd9226bc..d305135b18e 100644
--- a/indra/newview/lleventpoll.h
+++ b/indra/newview/lleventpoll.h
@@ -57,7 +57,7 @@ class LLEventPoll
 
 
 private:
-    boost::unique_ptr<LLEventPolling::Details::LLEventPollImpl>    mImpl;
+    boost::shared_ptr<LLEventPolling::Details::LLEventPollImpl>  mImpl;
 };
 
 
-- 
GitLab