From d1bc6d491ef3e139eeecaca14d551b55acf1ff3b Mon Sep 17 00:00:00 2001 From: Seonae Kim Date: Wed, 22 Aug 2012 15:11:36 +0900 Subject: [PATCH] [WK2] Fix location bug and crash issue for GoogleMap [Title] Fix location bug and crash issue for GoogleMap [Issue#] WEB-1617, WEB-1621 [Problem] 1. getCurrentPosition API returns 0,0 2. Browser crashed while reloading web page [Cause] 1. The result value of PositionChangedCallback is zero 2. EwkGeolocation is not checked [Solution] Add conditional statement to confirm the callback parameter Change-Id: If48462c6a92f3e9e8ed06dfdf0b7a7c016443873 --- Source/WebKit2/UIProcess/API/efl/ewk_geolocation.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_geolocation.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_geolocation.cpp index b883431..71533d2 100755 --- a/Source/WebKit2/UIProcess/API/efl/ewk_geolocation.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_geolocation.cpp @@ -47,6 +47,9 @@ struct _Ewk_Geolocation_Permission_Data { static void ewkGeolocationPositionChangedCallback(double latitude, double longitude, double altitude, time_t timestamp, void *user_data) { + if(!timestamp) + return; + WKRetainPtr position(AdoptWK, WKGeolocationPositionCreate(timestamp, latitude, longitude, 0.0f)); WKGeolocationManagerProviderDidChangePosition(static_cast(user_data), position.get()); } @@ -61,6 +64,9 @@ Ewk_Geolocation* ewkGeolocationCreateGeolocation() void ewkGeolocationDeleteGeolocation(Ewk_Geolocation* ewkGeolocation) { + if (ewkGeolocation->started) + ewkGeolocationStopLocationManager(ewkGeolocation); + delete ewkGeolocation; } @@ -82,6 +88,8 @@ void ewkGeolocationDeletePermission(Ewk_Geolocation_Permission_Data* permissionD bool ewkGeolocationStartLocationManager(WKGeolocationManagerRef geolocationManager, Ewk_Geolocation* ewkGeolocation) { + EINA_SAFETY_ON_NULL_RETURN_VAL(ewkGeolocation, false); + location_error_e ret = static_cast(location_manager_create(LOCATIONS_METHOD_HYBRID, &ewkGeolocation->locationManager)); if (ret != LOCATIONS_ERROR_NONE) return false; @@ -105,6 +113,8 @@ bool ewkGeolocationStartLocationManager(WKGeolocationManagerRef geolocationManag void ewkGeolocationStopLocationManager(Ewk_Geolocation* ewkGeolocation) { + EINA_SAFETY_ON_NULL_RETURN(ewkGeolocation); + if (!ewkGeolocation->started) return; @@ -119,6 +129,8 @@ void ewkGeolocationStopLocationManager(Ewk_Geolocation* ewkGeolocation) ret = static_cast(location_manager_destroy(ewkGeolocation->locationManager)); if (ret != LOCATIONS_ERROR_NONE) return; + + ewkGeolocation->started = false; } #endif -- 2.7.4