diff options
| author | Romain Guy <romainguy@google.com> | 2012-04-23 18:22:09 -0700 |
|---|---|---|
| committer | Romain Guy <romainguy@google.com> | 2012-04-23 20:29:31 -0700 |
| commit | ba6be8a62dcdb3ffd210cd36b9af4e3a658eac47 (patch) | |
| tree | 04f9b4d5589333970c91e51af6280a5859b78460 /core/java/android/os/MessageQueue.java | |
| parent | 88fffb7a34313d5e94b3974d444d07bd6a4879a4 (diff) | |
Prevent WebView from crashing when detached from the window
Bug #6365056
WebView enqueues a functor in the hardware renderer to handle
animations and this functor is called at a later time by the
hardware renderer. However, the functor was not removed from
the queue when WebView was removed from the window. This could
cause the hardware renderer to attempt to execute an invalid
functor and lead to a crash.
Change-Id: I9d38e80f3fdc5e29d4d0cdfa1e893c251a954508
Diffstat (limited to 'core/java/android/os/MessageQueue.java')
| -rw-r--r-- | core/java/android/os/MessageQueue.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/core/java/android/os/MessageQueue.java b/core/java/android/os/MessageQueue.java index 64027ef7fc81..5ad60ec0e7ee 100644 --- a/core/java/android/os/MessageQueue.java +++ b/core/java/android/os/MessageQueue.java @@ -347,6 +347,23 @@ public class MessageQueue { } } + final boolean hasMessages(Handler h, Runnable r, Object object) { + if (h == null) { + return false; + } + + synchronized (this) { + Message p = mMessages; + while (p != null) { + if (p.target == h && p.callback == r && (object == null || p.obj == object)) { + return true; + } + p = p.next; + } + return false; + } + } + final void removeMessages(Handler h, int what, Object object) { if (h == null) { return; |
