Bug 1336510 - Part 2: Fix lambda captures of this in PresentationConnection, r=smaug
☠☠ backed out by 3fee518242f6 ☠ ☠
authorMichael Layzell <michael@thelayzells.com>
Fri, 03 Feb 2017 16:55:22 -0500
changeset 344613 bd943b368ff7bce820d381fde4991b9bfb2168ca
parent 344612 c8b32cb1f15b5ad2588ddde5a3127697537b965a
child 344614 e842cdaaa7e5fb44c713917005b19feed9cf5b6e
push id31414
push usercbook@mozilla.com
push dateFri, 24 Feb 2017 10:47:41 +0000
treeherdermozilla-central@be661bae6cb9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1336510
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1336510 - Part 2: Fix lambda captures of this in PresentationConnection, r=smaug MozReview-Commit-ID: 2fuMHyspjhs
dom/presentation/PresentationConnection.cpp
--- a/dom/presentation/PresentationConnection.cpp
+++ b/dom/presentation/PresentationConnection.cpp
@@ -730,35 +730,36 @@ PresentationConnection::RemoveFromLoadGr
 void
 PresentationConnection::AsyncCloseConnectionWithErrorMsg(const nsAString& aMessage)
 {
   if (mState == PresentationConnectionState::Terminated) {
     return;
   }
 
   nsString message = nsString(aMessage);
+  RefPtr<PresentationConnection> self = this;
   nsCOMPtr<nsIRunnable> r =
-    NS_NewRunnableFunction([this, message]() -> void {
+    NS_NewRunnableFunction([self, message]() -> void {
       // Set |mState| to |PresentationConnectionState::Closed| here to avoid
       // calling |ProcessStateChanged|.
-      mState = PresentationConnectionState::Closed;
+      self->mState = PresentationConnectionState::Closed;
 
       // Make sure dispatching the event and closing the connection are invoked
       // at the same time by setting |aDispatchNow| to true.
       Unused << NS_WARN_IF(NS_FAILED(
-        DispatchConnectionCloseEvent(PresentationConnectionClosedReason::Error,
-                                      message,
-                                      true)));
+        self->DispatchConnectionCloseEvent(PresentationConnectionClosedReason::Error,
+                                           message,
+                                           true)));
 
       nsCOMPtr<nsIPresentationService> service =
         do_GetService(PRESENTATION_SERVICE_CONTRACTID);
       if(NS_WARN_IF(!service)) {
         return;
       }
 
       Unused << NS_WARN_IF(NS_FAILED(
-        service->CloseSession(mId,
-                              mRole,
+        service->CloseSession(self->mId,
+                              self->mRole,
                               nsIPresentationService::CLOSED_REASON_ERROR)));
     });
 
   Unused << NS_WARN_IF(NS_FAILED(NS_DispatchToMainThread(r)));
 }