Bug 1309823 - Forget file descriptors before starting actor destruction. r=billm, a=lizzard
authorBen Kelly <ben@wanderview.com>
Fri, 14 Oct 2016 08:27:28 +0200
changeset 356126 7bc185ff4e8b66536bf314f9cf8b03f7d7f0b9b8
parent 356125 24f9300535ef2054c3a367d6769e519ba836c8ed
child 356127 4e3bbc7340ea86d1cf6ded79305f0911b43aa989
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm, lizzard
bugs1309823
milestone51.0a2
Bug 1309823 - Forget file descriptors before starting actor destruction. r=billm, a=lizzard
ipc/glue/IPCStreamUtils.cpp
--- a/ipc/glue/IPCStreamUtils.cpp
+++ b/ipc/glue/IPCStreamUtils.cpp
@@ -172,42 +172,42 @@ CleanupIPCStream(IPCStream& aValue, bool
         OptionalFileDescriptorSet::TPFileDescriptorSetChild) {
 
       AutoTArray<FileDescriptor, 4> fds;
 
       auto fdSetActor = static_cast<FileDescriptorSetChild*>(
         streamWithFds.optionalFds().get_PFileDescriptorSetChild());
       MOZ_ASSERT(fdSetActor);
 
-      if (!aConsumedByIPC) {
-        Unused << fdSetActor->Send__delete__(fdSetActor);
-      }
-
       // FileDescriptorSet doesn't clear its fds in its ActorDestroy, so we
       // unconditionally forget them here.  The fds themselves are auto-closed in
       // ~FileDescriptor since they originated in this process.
       fdSetActor->ForgetFileDescriptors(fds);
 
+      if (!aConsumedByIPC) {
+        Unused << fdSetActor->Send__delete__(fdSetActor);
+      }
+
     } else if (streamWithFds.optionalFds().type() ==
                OptionalFileDescriptorSet::TPFileDescriptorSetParent) {
 
       AutoTArray<FileDescriptor, 4> fds;
 
       auto fdSetActor = static_cast<FileDescriptorSetParent*>(
         streamWithFds.optionalFds().get_PFileDescriptorSetParent());
       MOZ_ASSERT(fdSetActor);
 
-      if (!aConsumedByIPC) {
-        Unused << fdSetActor->Send__delete__(fdSetActor);
-      }
-
       // FileDescriptorSet doesn't clear its fds in its ActorDestroy, so we
       // unconditionally forget them here.  The fds themselves are auto-closed in
       // ~FileDescriptor since they originated in this process.
       fdSetActor->ForgetFileDescriptors(fds);
+
+      if (!aConsumedByIPC) {
+        Unused << fdSetActor->Send__delete__(fdSetActor);
+      }
     }
 
     return;
   }
 
   MOZ_ASSERT(aValue.type() == IPCStream::TPSendStreamChild);
 
   auto sendStream =