diff options
| author | 2019-04-16 14:19:55 -0700 | |
|---|---|---|
| committer | 2019-04-16 14:19:55 -0700 | |
| commit | b0022cc49371bfc5d9bd10fb8e60c29b1ff4aef6 (patch) | |
| tree | e55c8cad63eb07ab232d3388d5c763a43dbe1d43 | |
| parent | ab54fb71d630fc66f08c5711de55487b0bf29932 (diff) | |
blast: transaction ordering
This patch fixes two issues.
1) When a pending transactions is not found, don't try to use the iterator.
This fixes a crash that happens when we are in a bad state.
2) When a transaction doesn't have any callbacks, don't try to send
callbacks.
Bug: 130643588
Test: SurfaceFlinger_test
Change-Id: I6154c31dbf0b958683324c6b45e1a607691b84e8
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 2 | ||||
| -rw-r--r-- | services/surfaceflinger/TransactionCompletedThread.cpp | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 606355549e..48e1a64c7d 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -3617,7 +3617,7 @@ void SurfaceFlinger::applyTransactionState(const Vector<ComposerState>& states, } // If the state doesn't require a traversal and there are callbacks, send them now - if (!(clientStateFlags & eTraversalNeeded)) { + if (!(clientStateFlags & eTraversalNeeded) && !listenerCallbacks.empty()) { mTransactionCompletedThread.sendCallbacks(); } transactionFlags |= clientStateFlags; diff --git a/services/surfaceflinger/TransactionCompletedThread.cpp b/services/surfaceflinger/TransactionCompletedThread.cpp index 34df6068ee..b1bf4e20d3 100644 --- a/services/surfaceflinger/TransactionCompletedThread.cpp +++ b/services/surfaceflinger/TransactionCompletedThread.cpp @@ -141,12 +141,12 @@ status_t TransactionCompletedThread::addPresentedCallbackHandles( } else { ALOGW("there are more latched callbacks than there were registered callbacks"); } + if (listener->second.size() == 0) { + mPendingTransactions.erase(listener); + } } else { ALOGW("cannot find listener in mPendingTransactions"); } - if (listener->second.size() == 0) { - mPendingTransactions.erase(listener); - } status_t err = addCallbackHandle(handle); if (err != NO_ERROR) { |