Check if handles of session commands has been created successfully 17/144917/2 accepted/tizen/4.0/unified/20170828.223853 accepted/tizen/unified/20170822.023736 submit/tizen/20170821.023137 submit/tizen_4.0/20170828.100002 tizen_4.0.IoT.p1_release tizen_4.0.m2_release
authorchanywa <cbible.kim@samsung.com>
Fri, 18 Aug 2017 09:25:18 +0000 (18:25 +0900)
committerchanywa <cbible.kim@samsung.com>
Fri, 18 Aug 2017 09:55:35 +0000 (18:55 +0900)
Change-Id: I63ffd3e564591c97790d03e847f7910d982f78cb

capi-maps-service.changes
packaging/capi-maps-service.spec
src/session/command.cpp
src/session/commands.cpp

index b098bd9..e1c402d 100644 (file)
@@ -1,5 +1,10 @@
+[Version]   capi-maps-service_0.6.17
+[Date]      18 Aug 2017
+[Title]     Check if handles of session commands has been created successfully.
+[Developer] Seechan Kim <cbible.kim@samsung.com>
+
 [Version]   capi-maps-service_0.6.16
-[Date]      07 oct 2017
+[Date]      07 Aug 2017
 [Title]     Ensure internal hash table is empty before destroying maps handle.
 [Developer] Seechan Kim <cbible.kim@samsung.com>
 
index e4d42c2..1858031 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-maps-service
 Summary:    Tizen Maps Service API
-Version:    0.6.16
+Version:    0.6.17
 Release:    1
 Group:      Location/API
 License:    Apache-2.0
index 7ea1f94..f2973eb 100644 (file)
@@ -148,9 +148,8 @@ bool session::pending_request::add(const int user_req_id)
 
        if (contains(user_req_id))
                return false;   /* Attempt to add another instance of the id */
-       g_hash_table_insert(plg->pending_request_maps, int_dup(user_req_id),
-               NULL);
-       return true;
+
+       return g_hash_table_insert(plg->pending_request_maps, int_dup(user_req_id), NULL);
 }
 
 void session::pending_request::update(int user_req_id,
index d550297..26be51f 100644 (file)
@@ -146,15 +146,15 @@ int session::command_geocode::run()
        command_geocode_handler *handler = NULL;
        if (func) {
                /*  need to create the handler when the function is NULL */
-               pr.add(my_req_id);
-               handler = new (std::nothrow) command_geocode_handler(plugin(),
-                                            callback, user_data, my_req_id);
+               if (pr.add(my_req_id))
+                       handler = new (std::nothrow) command_geocode_handler(plugin(),
+                                                    callback, user_data, my_req_id);
 
                if (handler) {
                        /* Run the plugin interface function */
                        error = func(address.c_str(), preference,
-                                        command_geocode_handler::foreach_geocode_cb, handler,
-                                        &handler->plg_req_id);
+                                    command_geocode_handler::foreach_geocode_cb,
+                                    handler, &handler->plg_req_id);
 
                        pr.update(my_req_id, handler);
 
@@ -163,10 +163,7 @@ int session::command_geocode::run()
                        error = MAPS_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
                }
        } else {
-               /* Plugin Function is NULL: use default empty function */
-               /*
-               func = plugin::get_empty_interface().maps_plugin_geocode;
-               */
+               /* Plugin Function is NULL */
                MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin");
                error = MAPS_ERROR_NOT_SUPPORTED;
        }
@@ -268,15 +265,15 @@ int session::command_geocode_inside_bounds::run()
        command_geocode_handler *handler = NULL;
        if (func) {
                /* No need to create the handler when the function is NULL */
-               pr.add(my_req_id);
-               handler = new (std::nothrow) command_geocode_handler(plugin(),
-                                            callback, user_data, my_req_id);
+               if (pr.add(my_req_id))
+                       handler = new (std::nothrow) command_geocode_handler(plugin(),
+                                                    callback, user_data, my_req_id);
 
                if (handler) {
                        /* Run the plugin interface function */
                        error = func(address.c_str(), bounds, preference,
-                                    command_geocode_handler::foreach_geocode_cb,
-                                    handler, &handler->plg_req_id);
+                                    command_geocode_handler::foreach_geocode_cb,
+                                    handler, &handler->plg_req_id);
 
                        pr.update(my_req_id, handler);
 
@@ -285,11 +282,7 @@ int session::command_geocode_inside_bounds::run()
                        error = MAPS_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
                }
        } else {
-               /* Plugin Function is NULL: use default empty function */
-               /*
-               func = plugin::get_empty_interface().
-                       maps_plugin_geocode_inside_area;
-               */
+               /* Plugin Function is NULL */
                MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin");
                error = MAPS_ERROR_NOT_SUPPORTED;
        }
@@ -347,26 +340,22 @@ int session::command_geocode_by_structured_address::run()
        command_geocode_handler *handler = NULL;
        if (func) {
                /* No need to create the handler when the function is NULL */
-               pr.add(my_req_id);
-               handler = new (std::nothrow) command_geocode_handler(plugin(),
-                                            callback, user_data, my_req_id);
+               if (pr.add(my_req_id))
+                       handler = new (std::nothrow) command_geocode_handler(plugin(),
+                                                    callback, user_data, my_req_id);
 
                if (handler) {
                        /* Run the plugin interface function */
-                       error = func(address,
-                                                preference, command_geocode_handler::foreach_geocode_cb,
-                                                handler, &handler->plg_req_id);
+                       error = func(address, preference,
+                                    command_geocode_handler::foreach_geocode_cb,
+                                    handler, &handler->plg_req_id);
 
                        pr.update(my_req_id, handler);
                } else {
                        error = MAPS_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
                }
        } else {
-               /* Plugin Function is NULL: use default empty function */
-               /*
-               func = plugin::get_empty_interface().
-                       maps_plugin_geocode_by_structured_address;
-               */
+               /* Plugin Function is NULL */
                MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin");
                error = MAPS_ERROR_NOT_SUPPORTED;
        }
@@ -412,15 +401,15 @@ int session::command_reverse_geocode::run()
        command_reverse_geocode_handler *handler = NULL;
        if (func) {
                /* No need to create the handler when the function is NULL */
-               pr.add(my_req_id);
-               handler = new (std::nothrow) command_reverse_geocode_handler(plugin(),
-                                            callback, user_data, my_req_id);
+               if (pr.add(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 */
                        error = func(latitude, longitude, preference,
-                                               command_reverse_geocode_handler::foreach_reverse_geocode_cb,
-                                               handler, &handler->plg_req_id);
+                                    command_reverse_geocode_handler::foreach_reverse_geocode_cb,
+                                    handler, &handler->plg_req_id);
 
                        pr.update(my_req_id, handler);
 
@@ -429,11 +418,7 @@ int session::command_reverse_geocode::run()
                        error = MAPS_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
                }
        } else {
-               /* Plugin Function is NULL: use default empty function */
-               /*
-               func = plugin::get_empty_interface().
-                       maps_plugin_reverse_geocode;
-               */
+               /* Plugin Function is NULL */
                MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin");
                error = MAPS_ERROR_NOT_SUPPORTED;
        }
@@ -530,15 +515,15 @@ int session::command_multi_reverse_geocode::run()
        command_multi_reverse_geocode_handler *handler = NULL;
        if (func) {
                /* No need to create the handler when the function is NULL */
-               pr.add(my_req_id);
-               handler = new (std::nothrow) command_multi_reverse_geocode_handler(plugin(),
-                                            callback, user_data, my_req_id);
+               if (pr.add(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 */
                        error = func(maps_list, preference,
-                                               command_multi_reverse_geocode_handler::foreach_multi_reverse_geocode_cb,
-                                               handler, &handler->plg_req_id);
+                                    command_multi_reverse_geocode_handler::foreach_multi_reverse_geocode_cb,
+                                    handler, &handler->plg_req_id);
 
                        pr.update(my_req_id, handler);
 
@@ -547,11 +532,7 @@ int session::command_multi_reverse_geocode::run()
                        error = MAPS_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
                }
        } else {
-               /* Plugin Function is NULL: use default empty function */
-               /*
-               func = plugin::get_empty_interface().
-                       maps_plugin_multi_reverse_geocode;
-               */
+               /* Plugin Function is NULL */
                MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin");
                error = MAPS_ERROR_NOT_SUPPORTED;
        }
@@ -647,14 +628,15 @@ int session::command_search_place::run()
        command_search_place_handler *handler = NULL;
        if (func) {
                /* No need to create the handler when the function is NULL */
-               pr.add(my_req_id);
-               handler = new (std::nothrow) command_search_place_handler(plugin(),
-                                            callback, user_data, my_req_id);
+               if (pr.add(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,
-                                        command_search_place_handler::foreach_place_cb, handler,
-                                        &handler->plg_req_id);
+                                    command_search_place_handler::foreach_place_cb,
+                                    handler, &handler->plg_req_id);
 
                        pr.update(my_req_id, handler);
 
@@ -663,10 +645,7 @@ int session::command_search_place::run()
                        error = MAPS_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
                }
        } else {
-               /* Plugin Function is NULL: use default empty function */
-               /*
-               func = plugin::get_empty_interface().maps_plugin_search_place;
-               */
+               /* Plugin Function is NULL */
                MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin");
                error = MAPS_ERROR_NOT_SUPPORTED;
        }
@@ -773,14 +752,15 @@ int session::command_search_by_area_place::run()
        command_search_place_handler *handler = NULL;
        if (func) {
                /* No need to create the handler when the function is NULL */
-               pr.add(my_req_id);
-               handler = new (std::nothrow) command_search_place_handler(plugin(),
-                                            callback, user_data, my_req_id);
+               if (pr.add(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,
-                               preference, command_search_place_handler::foreach_place_cb,
-                               handler, &handler->plg_req_id);
+                                    preference, command_search_place_handler::foreach_place_cb,
+                                    handler, &handler->plg_req_id);
 
                        pr.update(my_req_id, handler);
 
@@ -789,12 +769,7 @@ int session::command_search_by_area_place::run()
                        error = MAPS_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
                }
        } else {
-               /* Plugin Function is NULL: use default empty function */
-               /*
-               func = plugin::get_empty_interface().
-                       maps_plugin_search_place_by_area;
-               */
-
+               /* Plugin Function is NULL */
                MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin");
                error = MAPS_ERROR_NOT_SUPPORTED;
        }
@@ -856,14 +831,15 @@ int session::command_search_by_address_place::run()
        command_search_place_handler *handler = NULL;
        if (func) {
                /* No need to create the handler when the function is NULL */
-               pr.add(my_req_id);
-               handler = new (std::nothrow) command_search_place_handler(plugin(),
-                                            callback, user_data, my_req_id);
+               if (pr.add(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,
-                                        command_search_place_handler::foreach_place_cb, handler,
-                                        &handler->plg_req_id);
+                                    command_search_place_handler::foreach_place_cb,
+                                    handler, &handler->plg_req_id);
 
                        pr.update(my_req_id, handler);
 
@@ -872,11 +848,7 @@ int session::command_search_by_address_place::run()
                        error = MAPS_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
                }
        } else {
-               /* Plugin Function is NULL: use default empty function */
-               /*
-               func = plugin::get_empty_interface().
-                       maps_plugin_search_place_by_address;
-               */
+               /* Plugin Function is NULL */
                MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin");
                error = MAPS_ERROR_NOT_SUPPORTED;
        }
@@ -934,14 +906,15 @@ int session::command_search_place_list::run()
        command_search_place_list_handler *handler = NULL;
        if (func) {
                /* No need to create the handler when the function is NULL */
-               pr.add(my_req_id);
-               handler = new (std::nothrow) command_search_place_list_handler(plugin(),
-                                            callback, user_data, my_req_id);
+               if (pr.add(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,
-                                        command_search_place_list_handler::foreach_place_list_cb, handler,
-                                        &handler->plg_req_id);
+                                    command_search_place_list_handler::foreach_place_list_cb,
+                                    handler, &handler->plg_req_id);
 
                        pr.update(my_req_id, handler);
 
@@ -950,10 +923,7 @@ int session::command_search_place_list::run()
                        error = MAPS_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
                }
        } else {
-               /* Plugin Function is NULL: use default empty function */
-               /*
-               func = plugin::get_empty_interface().maps_plugin_search_place_list;
-               */
+               /* Plugin Function is NULL */
                MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin");
                error = MAPS_ERROR_NOT_SUPPORTED;
        }
@@ -1034,14 +1004,15 @@ int session::command_get_place_details::run()
        command_get_place_details_handler *handler = NULL;
        if (func) {
                /* No need to create the handler when the function is NULL */
-               pr.add(my_req_id);
-               handler = new (std::nothrow) command_get_place_details_handler(plugin(),
-                                            callback, user_data, my_req_id);
+               if (pr.add(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);
 
@@ -1051,11 +1022,7 @@ int session::command_get_place_details::run()
                        error = MAPS_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
                }
        } else {
-               /* Plugin Function is NULL: use default empty function */
-               /*
-               func = plugin::get_empty_interface().
-                       maps_plugin_get_place_details;
-               */
+               /* Plugin Function is NULL */
                MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin");
                error = MAPS_ERROR_NOT_SUPPORTED;
        }
@@ -1163,15 +1130,15 @@ int session::command_search_route::run()
        command_search_route_handler *handler = NULL;
        if (func) {
                /* No need to create the handler when the function is NULL */
-               pr.add(my_req_id);
-               handler = new (std::nothrow) command_search_route_handler(plugin(),
-                                            callback, user_data, my_req_id);
+               if (pr.add(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(origin, destination, preference,
-                                                       command_search_route_handler::foreach_route_cb,
-                                                       handler, &handler->plg_req_id);
+                                    command_search_route_handler::foreach_route_cb,
+                                    handler, &handler->plg_req_id);
 
                        pr.update(my_req_id, handler);
 
@@ -1180,10 +1147,7 @@ int session::command_search_route::run()
                        error = MAPS_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
                }
        } else {
-               /* Plugin Function is NULL: use default empty function */
-               /*
-               func = plugin::get_empty_interface().maps_plugin_search_route;
-               */
+               /* Plugin Function is NULL */
                MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin");
                error = MAPS_ERROR_NOT_SUPPORTED;
        }
@@ -1252,14 +1216,15 @@ int session::command_search_route_waypoints::run()
        command_search_route_handler *handler = NULL;
        if (func) {
                /* No need to create the handler when the function is NULL */
-               pr.add(my_req_id);
-               handler = new (std::nothrow) command_search_route_handler(plugin(),
-                                            callback, user_data, my_req_id);
+               if (pr.add(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,
-                                        command_search_route_handler::foreach_route_cb, handler,
-                                        &handler->plg_req_id);
+                                    command_search_route_handler::foreach_route_cb, handler,
+                                    &handler->plg_req_id);
 
                        pr.update(my_req_id, handler);
 
@@ -1268,11 +1233,7 @@ int session::command_search_route_waypoints::run()
                        error = MAPS_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
                }
        } else {
-               /* Plugin Function is NULL: use default empty function */
-               /*
-               func = plugin::get_empty_interface().
-                       maps_plugin_search_route_waypoints;
-               */
+               /* Plugin Function is NULL */
                MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin");
                error = MAPS_ERROR_NOT_SUPPORTED;
        }