diff options
Diffstat (limited to 'WebCore')
-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) |