Apply to use std::nothrow when allocating memory with new operator 44/138644/2
authorchanywa <cbible.kim@samsung.com>
Thu, 13 Jul 2017 05:12:13 +0000 (14:12 +0900)
committerchanywa <cbible.kim@samsung.com>
Thu, 13 Jul 2017 07:11:39 +0000 (16:11 +0900)
Change-Id: I066926973ebf27f9947156c9b7bde0580de63645

capi-maps-service.changes
packaging/capi-maps-service.spec
src/api/maps_service.cpp
src/api/maps_view.cpp
src/maps_util.h
src/session/commands.cpp
src/view/gesture_processor.cpp
src/view/inertial_gesture.cpp

index 491b969..b5956ce 100644 (file)
@@ -1,3 +1,8 @@
+[Version]   capi-maps-service_0.6.13
+[Date]      13 Jul 2017
+[Title]     Apply to use std::nothrow when allocating memory with new operator
+[Developer] Seechan Kim <cbible.kim@samsung.com>
+
 [Version]   capi-maps-service_0.6.12
 [Date]      16 May 2017
 [Title]     Fix gesture bugs when using a mouse device
index e0d4045..58d0075 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-maps-service
 Summary:    Tizen Maps Service API
-Version:    0.6.12
+Version:    0.6.13
 Release:    1
 Group:      Location/API
 License:    Apache-2.0
index e61924f..db3c764 100644 (file)
@@ -376,7 +376,7 @@ EXPORT_API int maps_service_geocode(const maps_service_h maps,
        if (!maps_condition_check_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       session::command *cmd = new session::command_geocode(maps, address, preference,
+       session::command *cmd = new (std::nothrow) session::command_geocode(maps, address, preference,
                        callback, user_data, request_id);
 
        int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
@@ -411,7 +411,7 @@ EXPORT_API int maps_service_geocode_inside_area(const maps_service_h maps,
        if (!maps_condition_check_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       session::command *cmd = new session::command_geocode_inside_bounds(maps,
+       session::command *cmd = new (std::nothrow) session::command_geocode_inside_bounds(maps,
                        address, bounds, preference, callback, user_data, request_id);
 
        int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
@@ -445,7 +445,7 @@ EXPORT_API int maps_service_geocode_by_structured_address(const maps_service_h m
        if (!maps_condition_check_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       session::command *cmd = new session::command_geocode_by_structured_address(maps,
+       session::command *cmd = new (std::nothrow) session::command_geocode_by_structured_address(maps,
                        address, preference, callback, user_data, request_id);
 
        int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
@@ -484,7 +484,7 @@ EXPORT_API int maps_service_reverse_geocode(const maps_service_h maps,
        if (!maps_condition_check_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       session::command *cmd = new session::command_reverse_geocode(maps, latitude,
+       session::command *cmd = new (std::nothrow) session::command_reverse_geocode(maps, latitude,
                        longitude, preference, callback, user_data, request_id);
 
        int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
@@ -524,7 +524,7 @@ EXPORT_API int maps_service_search_place(const maps_service_h maps,
        if (!maps_condition_check_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       session::command *cmd = new session::command_search_place(maps, position,
+       session::command *cmd = new (std::nothrow) session::command_search_place(maps, position,
                        distance, preference, filter, callback, user_data, request_id);
 
        int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
@@ -560,7 +560,7 @@ EXPORT_API int maps_service_search_place_by_area(const maps_service_h maps,
        if (!maps_condition_check_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       session::command *cmd = new session::command_search_by_area_place(maps,
+       session::command *cmd = new (std::nothrow) session::command_search_by_area_place(maps,
                        boundary, preference, filter, callback, user_data, request_id);
 
        int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
@@ -597,7 +597,7 @@ EXPORT_API int maps_service_search_place_by_address(const maps_service_h maps,
        if (!maps_condition_check_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       session::command *cmd = new session::command_search_by_address_place(maps,
+       session::command *cmd = new (std::nothrow) session::command_search_by_address_place(maps,
                        address, boundary, preference, filter, callback, user_data, request_id);
 
        int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
@@ -628,7 +628,7 @@ EXPORT_API int maps_service_search_place_list(const maps_service_h maps,
        if (!maps_condition_check_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       session::command *cmd = new session::command_search_place_list(maps,
+       session::command *cmd = new (std::nothrow) session::command_search_place_list(maps,
                        boundary, preference, filter, callback, user_data, request_id);
 
        int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
@@ -656,7 +656,7 @@ EXPORT_API int maps_service_get_place_details(const maps_service_h maps,
        if (!maps_condition_check_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       session::command *cmd = new session::command_get_place_details(maps,
+       session::command *cmd = new (std::nothrow) session::command_get_place_details(maps,
                        url, callback, user_data, request_id);
 
        int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
@@ -695,7 +695,7 @@ EXPORT_API int maps_service_search_route(const maps_service_h maps,
        if (!maps_condition_check_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       session::command *cmd = new session::command_search_route(maps, preference,
+       session::command *cmd = new (std::nothrow) session::command_search_route(maps, preference,
                        origin, destination, callback, user_data, request_id);
 
        int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
@@ -732,7 +732,7 @@ EXPORT_API int maps_service_search_route_waypoints(const maps_service_h maps,
        if (!maps_condition_check_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       session::command *cmd = new session::command_search_route_waypoints(maps,
+       session::command *cmd = new (std::nothrow) session::command_search_route_waypoints(maps,
                        preference, waypoint_list, waypoint_num, callback, user_data, request_id);
 
        int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
@@ -765,7 +765,7 @@ EXPORT_API int maps_service_cancel_request(const maps_service_h maps, int reques
        if (!maps_condition_check_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       session::command *cmd = new session::command_cancel_request(maps, request_id);
+       session::command *cmd = new (std::nothrow) session::command_cancel_request(maps, request_id);
 
        int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
        if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
@@ -795,7 +795,7 @@ EXPORT_API int maps_service_multi_reverse_geocode(const maps_service_h maps,
        if (!maps_condition_check_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       session::command *cmd = new session::command_multi_reverse_geocode(maps,
+       session::command *cmd = new (std::nothrow) session::command_multi_reverse_geocode(maps,
                        coordinates_list, preference, callback, user_data, request_id);
 
        int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
index 992b860..fac2ccc 100644 (file)
@@ -581,7 +581,7 @@ EXPORT_API int maps_view_create(maps_service_h maps, Evas_Object *obj, maps_view
        v->gesture_available[MAPS_VIEW_GESTURE_NONE] = false;
 
        /* Gesture Processing */
-       v->finger_stream = new view::finger_event_stream(v);
+       v->finger_stream = new (std::nothrow) view::finger_event_stream(v);
        if (!v->finger_stream) {
                //LCOV_EXCL_START
                MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
@@ -1307,7 +1307,7 @@ int _maps_view_set_inertia_enabled(maps_view_h view, bool enabled)
 
        if (enabled) {
                if (!v->inertial_gesture) {
-                       v->inertial_gesture = new view::inertial_gesture(view);
+                       v->inertial_gesture = new (std::nothrow) view::inertial_gesture(view);
                        if (!v->inertial_gesture) {
                                //LCOV_EXCL_START
                                MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
@@ -1317,7 +1317,7 @@ int _maps_view_set_inertia_enabled(maps_view_h view, bool enabled)
                }
 
                if (!v->inertial_camera) {
-                       v->inertial_camera = new view::inertial_camera(view);
+                       v->inertial_camera = new (std::nothrow) view::inertial_camera(view);
                        if (!v->inertial_camera) {
                                //LCOV_EXCL_START
                                MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
@@ -1328,7 +1328,7 @@ int _maps_view_set_inertia_enabled(maps_view_h view, bool enabled)
 
                v->finger_stream->set_gesture_detector(v->inertial_gesture);
        } else {
-               v->finger_stream->set_gesture_detector(new view::gesture_detector_statemachine(view));
+               v->finger_stream->set_gesture_detector(new (std::nothrow) view::gesture_detector_statemachine(view));
 
                if (v->inertial_gesture) {
                        /* Unset Inertial Camera */
index 9aae621..f156406 100755 (executable)
@@ -18,6 +18,7 @@
 
 #include <dlog.h>
 #include <glib.h>
+#include <new>
 
 /*#include "stdio.h"
 
@@ -150,7 +151,7 @@ public:
 public:
        void push_back(const T &value)
        {
-               T *clone = new T(value);
+               T *clone = new (std::nothrow) T(value);
                if (clone) {
                        g_array_append_val(parray, clone);
                        current_size++;
index 0cda181..d550297 100644 (file)
@@ -147,8 +147,8 @@ int session::command_geocode::run()
        if (func) {
                /*  need to create the handler when the function is NULL */
                pr.add(my_req_id);
-               handler = new command_geocode_handler(plugin(),
-                                            callback, user_data, my_req_id);
+               handler = new (std::nothrow) command_geocode_handler(plugin(),
+                                            callback, user_data, my_req_id);
 
                if (handler) {
                        /* Run the plugin interface function */
@@ -269,10 +269,8 @@ int session::command_geocode_inside_bounds::run()
        if (func) {
                /* No need to create the handler when the function is NULL */
                pr.add(my_req_id);
-               handler = new command_geocode_handler(plugin(),
-                                                     callback,
-                                                     user_data,
-                                                     my_req_id);
+               handler = new (std::nothrow) command_geocode_handler(plugin(),
+                                            callback, user_data, my_req_id);
 
                if (handler) {
                        /* Run the plugin interface function */
@@ -350,10 +348,8 @@ int session::command_geocode_by_structured_address::run()
        if (func) {
                /* No need to create the handler when the function is NULL */
                pr.add(my_req_id);
-               handler = new command_geocode_handler(plugin(),
-                                                     callback,
-                                                     user_data,
-                                                     my_req_id);
+               handler = new (std::nothrow) command_geocode_handler(plugin(),
+                                            callback, user_data, my_req_id);
 
                if (handler) {
                        /* Run the plugin interface function */
@@ -417,10 +413,8 @@ int session::command_reverse_geocode::run()
        if (func) {
                /* No need to create the handler when the function is NULL */
                pr.add(my_req_id);
-               handler = new command_reverse_geocode_handler(plugin(),
-                                                             callback,
-                                                             user_data,
-                                                             my_req_id);
+               handler = new (std::nothrow) command_reverse_geocode_handler(plugin(),
+                                            callback, user_data, my_req_id);
 
                if (handler) {
                        /* Run the plugin interface function */
@@ -537,7 +531,8 @@ int session::command_multi_reverse_geocode::run()
        if (func) {
                /* No need to create the handler when the function is NULL */
                pr.add(my_req_id);
-               handler = new command_multi_reverse_geocode_handler(plugin(), callback, user_data, my_req_id);
+               handler = new (std::nothrow) command_multi_reverse_geocode_handler(plugin(),
+                                            callback, user_data, my_req_id);
 
                if (handler) {
                        /* Run the plugin interface function */
@@ -653,10 +648,8 @@ int session::command_search_place::run()
        if (func) {
                /* No need to create the handler when the function is NULL */
                pr.add(my_req_id);
-               handler = new command_search_place_handler(plugin(),
-                                                          callback,
-                                                          user_data,
-                                                          my_req_id);
+               handler = new (std::nothrow) command_search_place_handler(plugin(),
+                                            callback, user_data, my_req_id);
                if (handler) {
                        /* Run the plugin interface function */
                        error = func(position, distance, filter, preference,
@@ -781,10 +774,8 @@ int session::command_search_by_area_place::run()
        if (func) {
                /* No need to create the handler when the function is NULL */
                pr.add(my_req_id);
-               handler = new command_search_place_handler(plugin(),
-                                                          callback,
-                                                          user_data,
-                                                          my_req_id);
+               handler = new (std::nothrow) command_search_place_handler(plugin(),
+                                            callback, user_data, my_req_id);
                if (handler) {
                        /* Run the plugin interface function */
                        error = func(boundary, filter,
@@ -866,10 +857,8 @@ int session::command_search_by_address_place::run()
        if (func) {
                /* No need to create the handler when the function is NULL */
                pr.add(my_req_id);
-               handler = new command_search_place_handler(plugin(),
-                                                          callback,
-                                                          user_data,
-                                                          my_req_id);
+               handler = new (std::nothrow) command_search_place_handler(plugin(),
+                                            callback, user_data, my_req_id);
                if (handler) {
                        /* Run the plugin interface function */
                        error = func(address.c_str(), boundary, filter, preference,
@@ -946,10 +935,8 @@ int session::command_search_place_list::run()
        if (func) {
                /* No need to create the handler when the function is NULL */
                pr.add(my_req_id);
-               handler = new command_search_place_list_handler(plugin(),
-                                                          callback,
-                                                          user_data,
-                                                          my_req_id);
+               handler = new (std::nothrow) command_search_place_list_handler(plugin(),
+                                            callback, user_data, my_req_id);
                if (handler) {
                        /* Run the plugin interface function */
                        error = func(boundary, filter, preference,
@@ -1048,13 +1035,13 @@ int session::command_get_place_details::run()
        if (func) {
                /* No need to create the handler when the function is NULL */
                pr.add(my_req_id);
-               handler = new command_get_place_details_handler(plugin(),
-                                                          callback, user_data, my_req_id);
+               handler = new (std::nothrow) command_get_place_details_handler(plugin(),
+                                            callback, user_data, my_req_id);
                if (handler) {
                        /* Run the plugin interface function */
                        error = func(url.c_str(),
-                                        command_get_place_details_handler::foreach_place_details_cb,
-                                        handler, &handler->plg_req_id);
+                                       command_get_place_details_handler::foreach_place_details_cb,
+                                       handler, &handler->plg_req_id);
 
                        pr.update(my_req_id, handler);
 
@@ -1177,8 +1164,8 @@ int session::command_search_route::run()
        if (func) {
                /* No need to create the handler when the function is NULL */
                pr.add(my_req_id);
-               handler = new command_search_route_handler(plugin(),
-                                                       callback, user_data, my_req_id);
+               handler = new (std::nothrow) command_search_route_handler(plugin(),
+                                            callback, user_data, my_req_id);
 
                if (handler) {
                        /* Run the plugin interface function */
@@ -1228,27 +1215,31 @@ session::command_search_route_waypoints::command_search_route_waypoints(
        *request_id = command::command_request_id++;
        my_req_id = *request_id;
 
-       waypoint_list = new maps_coordinates_h[num];
-       for (int index = 0; index < num; index++) {
-               if (list[index] != NULL) {
-                       maps_coordinates_clone(list[index],
-                               &waypoint_list[index]);
+       waypoint_list = new (std::nothrow) maps_coordinates_h[num];
+       if (waypoint_list) {
+               for (int index = 0; index < num; index++) {
+                       if (list[index] != NULL)
+                               maps_coordinates_clone(list[index], &waypoint_list[index]);
                }
        }
 }
 
 session::command_search_route_waypoints::~command_search_route_waypoints()
 {
-       for (int index = 0; index < waypoint_num; index++) {
-               if (waypoint_list[index] != NULL) {
-                       maps_coordinates_destroy(waypoint_list[index]);
+       if (waypoint_list) {
+               for (int index = 0; index < waypoint_num; index++) {
+                       if (waypoint_list[index] != NULL)
+                               maps_coordinates_destroy(waypoint_list[index]);
                }
+               delete [] waypoint_list;
        }
-       delete [] waypoint_list;
 }
 
 int session::command_search_route_waypoints::run()
 {
+       if (!waypoint_list)
+               return MAPS_ERROR_OUT_OF_MEMORY;
+
        if (error != MAPS_ERROR_NONE)
                return error;
 
@@ -1262,10 +1253,8 @@ int session::command_search_route_waypoints::run()
        if (func) {
                /* No need to create the handler when the function is NULL */
                pr.add(my_req_id);
-               handler = new command_search_route_handler(plugin(),
-                                                callback,
-                                                user_data,
-                                                my_req_id);
+               handler = new (std::nothrow) command_search_route_handler(plugin(),
+                                            callback, user_data, my_req_id);
                if (handler) {
                        /* Run the plugin interface function */
                        error = func(waypoint_list, waypoint_num, preference,
index c981aac..6d48e1b 100644 (file)
@@ -178,7 +178,7 @@ session::command *view::gesture_processor::construct_gesture_command(
                        coords = center_clone;
                }
                session::command *cmd =
-                       new session::command_view_set_center(get_maps(), _gd->_view, coords);
+                       new (std::nothrow) session::command_view_set_center(get_maps(), _gd->_view, coords);
                maps_coordinates_destroy(center_clone);
                return cmd;
        }
@@ -186,13 +186,13 @@ session::command *view::gesture_processor::construct_gesture_command(
                MAPS_LOGD("MAPS_VIEW_ACTION_ZOOM_IN");
                if (zoom_factor == .0 || !zoom_changed)
                        maps_view_get_zoom_factor(_gd->_view, &zoom_factor);
-               return new session::command_view_zoom(get_maps(), _gd->_view, zoom_factor + 1.);
+               return new (std::nothrow) session::command_view_zoom(get_maps(), _gd->_view, zoom_factor + 1.);
        }
        case MAPS_VIEW_ACTION_ZOOM_OUT: {
                MAPS_LOGD("MAPS_VIEW_ACTION_ZOOM_OUT");
                if (zoom_factor == .0 || !zoom_changed)
                        maps_view_get_zoom_factor(_gd->_view, &zoom_factor);
-               return new session::command_view_zoom(get_maps(), _gd->_view, zoom_factor - 1.);
+               return new (std::nothrow) session::command_view_zoom(get_maps(), _gd->_view, zoom_factor - 1.);
        }
        case MAPS_VIEW_ACTION_ZOOM_AND_SCROLL: {
                MAPS_LOGD("MAPS_VIEW_ACTION_ZOOM_AND_SCROLL");
@@ -212,7 +212,7 @@ session::command *view::gesture_processor::construct_gesture_command(
                        coords = center_clone;
                }
                session::command *cmd =
-                       new session::command_view_set_center(get_maps(), _gd->_view, coords);
+                       new (std::nothrow) session::command_view_set_center(get_maps(), _gd->_view, coords);
                maps_coordinates_destroy(center_clone);
                return cmd;
        }
@@ -225,17 +225,17 @@ session::command *view::gesture_processor::construct_gesture_command(
                        if (rotation_angle == .0)
                                maps_view_get_orientation(_gd->_view, &rotation_angle);
                        rotation_angle -= (int(rotation_angle) / 360) * 360;
-                       return new session::command_view_zoom_rotate(get_maps(), _gd->_view, zoom_factor, rotation_angle);
+                       return new (std::nothrow) session::command_view_zoom_rotate(get_maps(), _gd->_view, zoom_factor, rotation_angle);
                } else if (zoom_changed) {
                        if (zoom_factor == .0)
                                maps_view_get_zoom_factor(_gd->_view, &zoom_factor);
                        MAPS_LOGI("\t set new zoom command: %f\n", zoom_factor);
-                       return new session::command_view_zoom(get_maps(), _gd->_view, zoom_factor);
+                       return new (std::nothrow) session::command_view_zoom(get_maps(), _gd->_view, zoom_factor);
                } else if (rotation_changed) {
                        if (rotation_angle == .0)
                                maps_view_get_orientation(_gd->_view, &rotation_angle);
                        rotation_angle -= (int(rotation_angle) / 360) * 360;
-                       return new session::command_view_rotate(get_maps(), _gd->_view, rotation_angle);
+                       return new (std::nothrow) session::command_view_rotate(get_maps(), _gd->_view, rotation_angle);
                }
                break;
        }
@@ -701,11 +701,10 @@ void view::gesture_processor::on_zoom_rotate(bool zoom_changed, double zoom_fact
 view::finger_event_stream::finger_event_stream(maps_view_h v)
        : _d(NULL)
 {
-       /* TODO: extract in dedicated factory in maps_view.cpp */
        /* Issuing an instance of gestuer detector */
-       _d = new gesture_detector_statemachine(v);
-       /*_d = new inertial_gesture(v);*/
-       /*_d = new gesture_detector(v);*/
+       _d = new (std::nothrow) gesture_detector_statemachine(v);
+       if (!_d)
+               MAPS_LOGE("Failed to create a gesture detector statemachine.");
 
        /* All fingers are un-pressed initially */
        for(int i = 0; i < MAX_FINGERS; i ++) {
@@ -718,6 +717,8 @@ void view::finger_event_stream::set_gesture_detector(gesture_detector *d)
 {
        if (!d)
                return;
+       if (!_d)
+               _d = d;
        if (d != _d) {
                _d->halt_gesture();
                delete _d;
@@ -737,7 +738,7 @@ view::finger_event_stream::~finger_event_stream()
 void view::finger_event_stream::tap(Evas_Event_Mouse_Down *ev)
 {
        MAPS_LOGI("finger_event_stream::tap");
-       if (!ev)
+       if (!ev || !_d)
                return;
 
        /*
@@ -762,7 +763,7 @@ void view::finger_event_stream::tap(Evas_Event_Mouse_Down *ev)
 
 void view::finger_event_stream::move(Evas_Event_Mouse_Move *ev)
 {
-       if (!ev)
+       if (!ev || !_d)
                return;
 
        if (_finger_pressed[0] == false)
@@ -793,7 +794,7 @@ void view::finger_event_stream::move(Evas_Event_Mouse_Move *ev)
 void view::finger_event_stream::up(Evas_Event_Mouse_Up *ev)
 {
        MAPS_LOGI("finger_event_stream::up");
-       if (!ev)
+       if (!ev || !_d)
                return;
 
        /* Process finger up */
@@ -807,7 +808,7 @@ void view::finger_event_stream::up(Evas_Event_Mouse_Up *ev)
 void view::finger_event_stream::multi_tap(Evas_Event_Multi_Down *ev)
 {
        MAPS_LOGI("finger_event_stream::multi_tap");
-       if (!ev)
+       if (!ev || !_d)
                return;
 
        const int finger_no = (ev->device > 0 ? 1 : 0);
@@ -836,7 +837,7 @@ void view::finger_event_stream::multi_tap(Evas_Event_Multi_Down *ev)
 
 void view::finger_event_stream::multi_move(Evas_Event_Multi_Move *ev)
 {
-       if (!ev)
+       if (!ev || !_d)
                return;
 
        const int finger_no = (ev->device > 0 ? 1 : 0);
@@ -871,7 +872,7 @@ void view::finger_event_stream::multi_move(Evas_Event_Multi_Move *ev)
 void view::finger_event_stream::multi_up(Evas_Event_Multi_Up *ev)
 {
        MAPS_LOGI("finger_event_stream::multi_up");
-       if (!ev)
+       if (!ev || !_d)
                return;
 
        const int finger_no = (ev->device > 0 ? 1 : 0);
index a7fcd95..acb8060 100644 (file)
@@ -37,7 +37,7 @@ view::inertial_gesture::inertial_gesture(maps_view_h view)
 {
        reset();
 
-       _d = new gesture_detector_statemachine(view);
+       _d = new (std::nothrow) gesture_detector_statemachine(view);
 
        //_maps_view_set_idle_listener(view, on_idle, this);
 }
@@ -66,8 +66,7 @@ view::inertial_gesture &view::inertial_gesture::operator=(const inertial_gesture
 
 void view::inertial_gesture::tap(int finger_no, const touch_point &tp)
 {
-       MAPS_LOGI("TRANSITION finger %d tap time: %d",
-                 finger_no, tp._timestamp);
+       MAPS_LOGI("TRANSITION finger %d tap time: %d", finger_no, tp._timestamp);
 
        _maps_view_halt_inertial_camera(_view);
 
@@ -217,7 +216,7 @@ double view::inertial_gesture::get_next_derivative(const double &derivative,
        else
                return (derivative - __ACCEL * dt);*/
 
-       /* Exponential spped down */
+       /* Exponential speed down */
        if (_d->_info._fingers_pressed <= 1)
                return (derivative * .9);
        else