summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2011-03-09 09:26:57 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-03-09 09:26:57 -0800
commit615fcf00641400b4851396f3ac5525818c4aa33a (patch)
treec482066111b7e73816171bcfd1e4c4a3dd6657fc
parentd9fa508e3486607d040245aac43aa3f60e761a03 (diff)
parentd1f25a8a55bba56cdfbe6275a04028e5f85d6bda (diff)
downloadexternal_webkit-615fcf00641400b4851396f3ac5525818c4aa33a.zip
external_webkit-615fcf00641400b4851396f3ac5525818c4aa33a.tar.gz
external_webkit-615fcf00641400b4851396f3ac5525818c4aa33a.tar.bz2
Merge "Prevent double deletion when timer callback causes plugin to be deleted." into honeycomb-mr1
-rw-r--r--WebKit/android/plugins/PluginTimer.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/WebKit/android/plugins/PluginTimer.cpp b/WebKit/android/plugins/PluginTimer.cpp
index 9ed6a80..dfa7272 100644
--- a/WebKit/android/plugins/PluginTimer.cpp
+++ b/WebKit/android/plugins/PluginTimer.cpp
@@ -71,7 +71,12 @@ namespace WebCore {
if (!m_unscheduled)
m_timerFunc(m_instance, m_timerID);
- if (!m_repeat || m_unscheduled)
+ // remove the timer if it is a one-shot timer (!m_repeat) or if is a
+ // repeating timer that has been unscheduled. In either case we must
+ // ensure that the refcount is 2 or greater since the PluginTimerList
+ // could have been deleted by the timerFunc and we must ensure that we
+ // do not double delete.
+ if ((!m_repeat || m_unscheduled) && refCount() > 1)
deref(); // mark the timer for deletion as it is no longer needed
}