Bug 1089214 - Avoid using null query in D3D9SurfaceImage::EnsureSynchronized. r=nical, a=lsblakk
authorAndreas Pehrson <pehrsons@gmail.com>
Thu, 27 Nov 2014 17:56:00 -0800
changeset 234329 166f199a7fb6d150c538192a1169143332dd5515
parent 234328 afdec215a78b3e67cc5af4c4f71af75bc6eb1f12
child 234330 1c97f07f4f7df068f24b2e38dde705e6e3db5536
push id4268
push userryanvm@gmail.com
push dateMon, 22 Dec 2014 22:22:50 +0000
treeherdermozilla-beta@e83d78f377b6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical, lsblakk
bugs1089214
milestone35.0
Bug 1089214 - Avoid using null query in D3D9SurfaceImage::EnsureSynchronized. r=nical, a=lsblakk
gfx/layers/D3D9SurfaceImage.cpp
--- a/gfx/layers/D3D9SurfaceImage.cpp
+++ b/gfx/layers/D3D9SurfaceImage.cpp
@@ -87,22 +87,23 @@ D3D9SurfaceImage::SetData(const Data& aD
   mQuery = query;
 
   return S_OK;
 }
 
 void
 D3D9SurfaceImage::EnsureSynchronized()
 {
-  if (!mQuery) {
+  RefPtr<IDirect3DQuery9> query = mQuery;
+  if (!query) {
     // Not setup, or already synchronized.
     return;
   }
   int iterations = 0;
-  while (iterations < 10 && S_FALSE == mQuery->GetData(nullptr, 0, D3DGETDATA_FLUSH)) {
+  while (iterations < 10 && S_FALSE == query->GetData(nullptr, 0, D3DGETDATA_FLUSH)) {
     Sleep(1);
     iterations++;
   }
   mQuery = nullptr;
 }
 
 HANDLE
 D3D9SurfaceImage::GetShareHandle()