Bug 1346507 - Fix. r=mccr8
authorKannan Vijayan <kvijayan@mozilla.com>
Sat, 13 May 2017 00:53:14 -0400
changeset 358156 da65be0462e0d90c4845bc8895464dc5178016a5
parent 358155 d7711b69b0136381c4da5cd292619d514ffee1ee
child 358157 5d4a586ccc42c3f535802f513f488a53e3199134
push id90283
push userkvijayan@mozilla.com
push dateSat, 13 May 2017 04:53:22 +0000
treeherdermozilla-inbound@da65be0462e0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1346507
milestone55.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 1346507 - Fix. r=mccr8
dom/flyweb/FlyWebService.cpp
--- a/dom/flyweb/FlyWebService.cpp
+++ b/dom/flyweb/FlyWebService.cpp
@@ -1101,17 +1101,24 @@ FlyWebService::Observe(nsISupports* aSub
 
   nsCOMPtr<nsISupportsPRUint64> wrapper = do_QueryInterface(aSubject);
   NS_ENSURE_TRUE(wrapper, NS_ERROR_FAILURE);
 
   uint64_t innerID;
   nsresult rv = wrapper->GetData(&innerID);
   NS_ENSURE_SUCCESS(rv, rv);
 
+  // Make a copy of mServers to iterate over, because closing a server
+  // can remove entries from mServers.
+  nsCOMArray<FlyWebPublishedServer> serversCopy;
   for (FlyWebPublishedServer* server : mServers) {
+    serversCopy.AppendElement(server);
+  }
+
+  for (FlyWebPublishedServer* server : serversCopy) {
     if (server->OwnerWindowID() == innerID) {
       server->Close();
     }
   }
 
   return NS_OK;
 }