OSDN Git Service

Delete TextureGenerator operations outside the lock
authorChris Craik <ccraik@google.com>
Tue, 6 Dec 2011 01:26:07 +0000 (17:26 -0800)
committerChris Craik <ccraik@google.com>
Tue, 6 Dec 2011 01:29:50 +0000 (17:29 -0800)
bug:5713701

This fixes a potential deadlock between TextureGenerator and ImagesManager

Change-Id: I57503d3b73aff571629826f2278491232b37cb67

Source/WebCore/platform/graphics/android/TexturesGenerator.cpp

index 0820688..bccb99b 100644 (file)
@@ -184,11 +184,10 @@ bool TexturesGenerator::threadLoop()
             m_currentOperation->run();
         }
 
+        QueuedOperation* oldOperation = m_currentOperation;
         mRequestedOperationsLock.lock();
-        if (m_currentOperation) {
-            delete m_currentOperation;
+        if (m_currentOperation)
             m_currentOperation = 0;
-        }
         if (!mRequestedOperations.size())
             stop = true;
         if (m_waitForCompletion) {
@@ -197,7 +196,8 @@ bool TexturesGenerator::threadLoop()
             mRequestedOperationsCond.signal();
         }
         mRequestedOperationsLock.unlock();
-
+        if (oldOperation)
+            delete oldOperation; // delete outside lock
     }
     XLOG("threadLoop empty");