summaryrefslogtreecommitdiffstats
path: root/WebKit
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2011-01-25 11:02:02 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-01-25 11:02:02 -0800
commit5db24b8cfc8994f0d6f5118ed8dca23028c74fed (patch)
tree46bb0a234585d7ae5814fa4a1fbb185039200c01 /WebKit
parent68934d8facb223c3f0bc1f44f36554b3c39dc8ea (diff)
parent7e336d32d9c3465ff9792faa8ccc8613b7849e4c (diff)
downloadexternal_webkit-5db24b8cfc8994f0d6f5118ed8dca23028c74fed.zip
external_webkit-5db24b8cfc8994f0d6f5118ed8dca23028c74fed.tar.gz
external_webkit-5db24b8cfc8994f0d6f5118ed8dca23028c74fed.tar.bz2
Merge "Prevent timer from deleting itself twice." into honeycomb
Diffstat (limited to 'WebKit')
-rw-r--r--WebKit/android/plugins/PluginTimer.cpp16
-rw-r--r--WebKit/android/plugins/PluginTimer.h3
2 files changed, 14 insertions, 5 deletions
diff --git a/WebKit/android/plugins/PluginTimer.cpp b/WebKit/android/plugins/PluginTimer.cpp
index ae7cb84..23cac77 100644
--- a/WebKit/android/plugins/PluginTimer.cpp
+++ b/WebKit/android/plugins/PluginTimer.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "PluginTimer.h"
+#include "RefPtr.h"
namespace WebCore {
@@ -63,11 +64,14 @@ namespace WebCore {
void PluginTimer::fired()
{
+ // ensure the timer cannot be deleted until this method completes
+ RefPtr<PluginTimer> protector(this);
+
if (!m_unscheduled)
m_timerFunc(m_instance, m_timerID);
if (!m_repeat || m_unscheduled)
- delete this;
+ deref(); // mark the timer for deletion as it is no longer needed
}
// may return null if timerID is not found
@@ -84,11 +88,15 @@ namespace WebCore {
}
///////////////////////////////////////////////////////////////////////////
-
+
PluginTimerList::~PluginTimerList()
{
- while (m_list) {
- delete m_list;
+ PluginTimer* curr = m_list;
+ PluginTimer* next;
+ while (curr) {
+ next = curr->next();
+ curr->deref();
+ curr = next;
}
}
diff --git a/WebKit/android/plugins/PluginTimer.h b/WebKit/android/plugins/PluginTimer.h
index dcb29bf..20c0816 100644
--- a/WebKit/android/plugins/PluginTimer.h
+++ b/WebKit/android/plugins/PluginTimer.h
@@ -27,6 +27,7 @@
#ifndef PluginTimer_H
#define PluginTimer_H
+#include "RefCounted.h"
#include "Timer.h"
#include "npapi.h"
@@ -34,7 +35,7 @@ namespace WebCore {
class PluginTimerList;
- class PluginTimer : public TimerBase {
+ class PluginTimer : public TimerBase, public RefCounted<PluginTimer> {
public:
PluginTimer(PluginTimer** list, NPP instance, bool repeat,
void (*proc)(NPP npp, uint32_t timerID));