Fix shutdown crash in VsyncBridgeChild when the GPU process is enabled. (bug 1314816, r=mattwoodrow)
authorDavid Anderson <danderson@mozilla.com>
Wed, 02 Nov 2016 16:45:38 -0700
changeset 320812 c3c0827d6c66d6cfdacaa6ae29b24f5b924ab851
parent 320811 2e8791563f4d6e7715674c9b53135a6a400178f2
child 320813 227bccbfea15ddf0b0105cdecf54c77fbeb87ad3
push id30905
push userphilringnalda@gmail.com
push dateFri, 04 Nov 2016 02:33:06 +0000
treeherdermozilla-central@4f09d9469e73 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1314816
milestone52.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
Fix shutdown crash in VsyncBridgeChild when the GPU process is enabled. (bug 1314816, r=mattwoodrow)
gfx/ipc/GPUProcessManager.cpp
gfx/ipc/VsyncBridgeChild.cpp
--- a/gfx/ipc/GPUProcessManager.cpp
+++ b/gfx/ipc/GPUProcessManager.cpp
@@ -392,17 +392,20 @@ GPUProcessManager::DestroyProcess()
   if (!mProcess) {
     return;
   }
 
   mProcess->Shutdown();
   mProcessToken = 0;
   mProcess = nullptr;
   mGPUChild = nullptr;
-  mVsyncBridge = nullptr;
+  if (mVsyncBridge) {
+    mVsyncBridge->Close();
+    mVsyncBridge = nullptr;
+  }
 }
 
 RefPtr<CompositorSession>
 GPUProcessManager::CreateTopLevelCompositor(nsBaseWidget* aWidget,
                                             ClientLayerManager* aLayerManager,
                                             CSSToLayoutDeviceScale aScale,
                                             bool aUseAPZ,
                                             bool aUseExternalSurfaceSize,
--- a/gfx/ipc/VsyncBridgeChild.cpp
+++ b/gfx/ipc/VsyncBridgeChild.cpp
@@ -109,18 +109,24 @@ VsyncBridgeChild::Close()
     mLoop->PostTask(NewRunnableMethod(this, &VsyncBridgeChild::Close));
     return;
   }
 
   // We clear mProcessToken when the channel is closed.
   if (!mProcessToken) {
     return;
   }
+
+  // Clear the process token so we don't notify the GPUProcessManager. It already
+  // knows we're closed since it manually called Close, and in fact the GPM could
+  // have already been destroyed during shutdown.
+  mProcessToken = 0;
+
+  // Close the underlying IPC channel.
   PVsyncBridgeChild::Close();
-  mProcessToken = 0;
 }
 
 void
 VsyncBridgeChild::ActorDestroy(ActorDestroyReason aWhy)
 {
   if (mProcessToken) {
     GPUProcessManager::Get()->NotifyRemoteActorDestroyed(mProcessToken);
     mProcessToken = 0;