diff options
author | Steve Block <steveblock@google.com> | 2009-12-03 11:11:15 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2009-12-03 11:34:14 +0000 |
commit | 4cde69e96bdfa8e4abe06985ab19e407696539cf (patch) | |
tree | 512fdba53d7fb3619122b5c72c35f4533ad7fe86 /WebCore/page | |
parent | c1cf958cf053d63e0f2a09d2af1ec2fafdd32cd9 (diff) | |
download | external_webkit-4cde69e96bdfa8e4abe06985ab19e407696539cf.zip external_webkit-4cde69e96bdfa8e4abe06985ab19e407696539cf.tar.gz external_webkit-4cde69e96bdfa8e4abe06985ab19e407696539cf.tar.bz2 |
Fixes a crashing Geolocation bug when a watch is cleared from certain callbacks.
BUG: http://b/2297475
This will be upstreamed to webkit.org in https://bugs.webkit.org/show_bug.cgi?id=32111
Change-Id: I70c3076b1a85c89bc4c587ea9fedaa84bd7b0575
Diffstat (limited to 'WebCore/page')
-rw-r--r-- | WebCore/page/Geolocation.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/WebCore/page/Geolocation.cpp b/WebCore/page/Geolocation.cpp index e0352dd..978a1b0 100644 --- a/WebCore/page/Geolocation.cpp +++ b/WebCore/page/Geolocation.cpp @@ -87,17 +87,21 @@ void Geolocation::GeoNotifier::timerFired(Timer<GeoNotifier>*) { m_timer.stop(); + // Cache our pointer to the Geolocation object, as this object could be + // deleted by a call to clearWatch in a callback. + Geolocation* geolocation = m_geolocation; + if (m_fatalError) { if (m_errorCallback) m_errorCallback->handleEvent(m_fatalError.get()); // This will cause this notifier to be deleted. - m_geolocation->fatalErrorOccurred(this); + geolocation->fatalErrorOccurred(this); return; } if (m_cachedPosition) { m_successCallback->handleEvent(m_cachedPosition.get()); - m_geolocation->requestReturnedCachedPosition(this); + geolocation->requestReturnedCachedPosition(this); return; } @@ -105,7 +109,7 @@ void Geolocation::GeoNotifier::timerFired(Timer<GeoNotifier>*) RefPtr<PositionError> error = PositionError::create(PositionError::TIMEOUT, "Timeout expired"); m_errorCallback->handleEvent(error.get()); } - m_geolocation->requestTimedOut(this); + geolocation->requestTimedOut(this); } void Geolocation::Watchers::set(int id, PassRefPtr<GeoNotifier> notifier) |