Bug 627399: Do not forget mTarget if a transaction is incomplete. r=cjoned a=blocking-beta10
authorBas Schouten <bschouten@mozilla.com>
Fri, 21 Jan 2011 06:46:38 +0100
changeset 61069 b7ea3d9683bad08798a619a99f13297c586fd88f
parent 61068 aa618e93942e2491f5f19d14b70d13b12fcaad13
child 61070 2b3bc2611e6e6ad37f604043ac4da1d0cbb08ea5
push idunknown
push userunknown
push dateunknown
reviewerscjoned, blocking-beta10
bugs627399
milestone2.0b10pre
Bug 627399: Do not forget mTarget if a transaction is incomplete. r=cjoned a=blocking-beta10
gfx/layers/basic/BasicLayers.cpp
--- a/gfx/layers/basic/BasicLayers.cpp
+++ b/gfx/layers/basic/BasicLayers.cpp
@@ -1282,34 +1282,47 @@ BasicLayerManager::EndTransactionInterna
     // transaction before the system updates the window), or we have no
     // overlapping or transparent layers in the update region, in which case
     // our partial transaction drawing will look fine.
     if (useDoubleBuffering && !mTransactionIncomplete) {
       finalTarget->SetOperator(gfxContext::OPERATOR_SOURCE);
       PopGroupWithCachedSurface(finalTarget, cachedSurfaceOffset);
     }
 
-    mTarget = nsnull;
+    if (!mTransactionIncomplete) {
+      // Clear out target if we have a complete transaction.
+      mTarget = nsnull;
+    } else {
+      // If we don't have a complete transaction set back to the old mTarget.
+      mTarget = finalTarget;
+    }
   }
 
 #ifdef MOZ_LAYERS_HAVE_LOG
   Log();
   MOZ_LAYERS_LOG(("]----- EndTransaction"));
 #endif
 
 #ifdef DEBUG
   // Go back to the construction phase if the transaction isn't complete.
   // Layout will update the layer tree and call EndTransaction().
   mPhase = mTransactionIncomplete ? PHASE_CONSTRUCTION : PHASE_NONE;
 #endif
-  mUsingDefaultTarget = PR_FALSE;
+
+  if (!mTransactionIncomplete) {
+    // This is still valid if the transaction was incomplete.
+    mUsingDefaultTarget = PR_FALSE;
+  }
 
   NS_ASSERTION(!aCallback || !mTransactionIncomplete,
                "If callback is not null, transaction must be complete");
 
+  // XXX - We should probably assert here that for an incomplete transaction
+  // out target is the default target.
+
   return !mTransactionIncomplete;
 }
 
 bool
 BasicLayerManager::EndEmptyTransaction()
 {
   if (!mRoot) {
     return false;