Bug 1335460 - Release globals properly when GetFilesHelper is destroyed on the main thread. r=smaug, a=ritu
authorNathan Froyd <froydnj@mozilla.com>
Tue, 31 Jan 2017 13:08:28 -0500
changeset 358864 d06f2bf30b22a04b03e2046d5c148adedd6777c1
parent 358863 c7fe5329bb0a133d28a2b566ce3e942f86d5742d
child 358865 fb3814280e1a5b280c3498ebc3b5590bebdfc0c7
push id10664
push userryanvm@gmail.com
push dateWed, 01 Feb 2017 23:16:10 +0000
treeherdermozilla-aurora@d06f2bf30b22 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, ritu
bugs1335460
milestone53.0a2
Bug 1335460 - Release globals properly when GetFilesHelper is destroyed on the main thread. r=smaug, a=ritu
dom/filesystem/GetFilesHelper.cpp
--- a/dom/filesystem/GetFilesHelper.cpp
+++ b/dom/filesystem/GetFilesHelper.cpp
@@ -20,22 +20,23 @@ class ReleaseRunnable final : public Run
 {
 public:
   static void
   MaybeReleaseOnMainThread(nsTArray<RefPtr<Promise>>& aPromises,
                            nsTArray<RefPtr<GetFilesCallback>>& aCallbacks,
                            Sequence<RefPtr<File>>& aFiles,
                            already_AddRefed<nsIGlobalObject> aGlobal)
   {
+    nsCOMPtr<nsIGlobalObject> global(aGlobal);
     if (NS_IsMainThread()) {
       return;
     }
 
     RefPtr<ReleaseRunnable> runnable =
-      new ReleaseRunnable(aPromises, aCallbacks, aFiles, Move(aGlobal));
+      new ReleaseRunnable(aPromises, aCallbacks, aFiles, global.forget());
     NS_DispatchToMainThread(runnable);
   }
 
   NS_IMETHOD
   Run() override
   {
     MOZ_ASSERT(NS_IsMainThread());