Bug 639885 - Abort the program execution if the status of program is unsafe due to thread safety issues in ReadbackManagerD3D10; r=Bas,jrmuizel,cjones a=beltzner GECKO20b12_2011022218_RELBRANCH
☠☠ backed out by 864d3507de6e ☠ ☠
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 09 Mar 2011 09:49:29 -0500
branchGECKO20b12_2011022218_RELBRANCH
changeset 63363 30a98bd29e537f9f6418b0245bbab9155501b5a5
parent 62978 60d3dff2ab523182aaa9c41a70c0a13507161a34
child 63364 864d3507de6e5a7585da08c527200c91164026b7
push id19167
push usereakhgari@mozilla.com
push dateWed, 09 Mar 2011 15:48:10 +0000
treeherdermozilla-central@30a98bd29e53 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas, jrmuizel, cjones, beltzner
bugs639885
milestone2.0b12
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 639885 - Abort the program execution if the status of program is unsafe due to thread safety issues in ReadbackManagerD3D10; r=Bas,jrmuizel,cjones a=beltzner
gfx/layers/d3d10/ReadbackManagerD3D10.cpp
--- a/gfx/layers/d3d10/ReadbackManagerD3D10.cpp
+++ b/gfx/layers/d3d10/ReadbackManagerD3D10.cpp
@@ -152,17 +152,17 @@ ReadbackManagerD3D10::~ReadbackManagerD3
   // to leak the thread and its synchronisation in favor of crashing or freezing
   DWORD result = ::WaitForSingleObject(mTaskThread, 5000);
   if (result != WAIT_TIMEOUT) {
     ::DeleteCriticalSection(&mTaskMutex);
     ::CloseHandle(mShutdownEvent);
     ::CloseHandle(mTaskSemaphore);
     ::CloseHandle(mTaskThread);
   } else {
-    NS_WARNING("ReadbackManager: Task thread did not shutdown in 5 seconds. Leaking.");
+    NS_RUNTIMEABORT("ReadbackManager: Task thread did not shutdown in 5 seconds.");
   }
 }
 
 void
 ReadbackManagerD3D10::PostTask(ID3D10Texture2D *aTexture, void *aUpdate, const gfxPoint &aOrigin)
 {
   ReadbackTask *task = new ReadbackTask;
   task->mReadbackTexture = aTexture;
@@ -222,16 +222,19 @@ ReadbackManagerD3D10::ProcessTasks()
   
   while (true) {
     DWORD result = ::WaitForMultipleObjects(2, handles, FALSE, INFINITE);
     if (result != WAIT_OBJECT_0) {
       return;
     }
 
     ::EnterCriticalSection(&mTaskMutex);
+    if (mPendingReadbackTasks.Length() == 0) {
+      NS_RUNTIMEABORT("Trying to read from an empty array, bad bad bad");
+    }
     ReadbackTask *nextReadbackTask = mPendingReadbackTasks[0].forget();
     mPendingReadbackTasks.RemoveElementAt(0);
     ::LeaveCriticalSection(&mTaskMutex);
 
     // We want to block here until the texture contents are available, the
     // easiest thing is to simply map and unmap.
     D3D10_MAPPED_TEXTURE2D mappedTex;
     nextReadbackTask->mReadbackTexture->Map(0, D3D10_MAP_READ, 0, &mappedTex);