Fixed to check whether Ethernet cable state changed callback exists when it is released 61/110761/1
authorJaehyun Kim <jeik01.kim@samsung.com>
Fri, 6 Jan 2017 08:15:35 +0000 (17:15 +0900)
committerchleun.moon <chleun.moon@samsung.com>
Wed, 18 Jan 2017 02:02:39 +0000 (11:02 +0900)
The callback can be registered for each connection handle
and the ref count is incremented each time it is registered.
However, when the callback is released,
the ref count is decremented without checking whether or not the callback is registered in the connection handle.
Therefore, the ref count can be 0 even though there is a valid callback, and the event may not be processed.

Change-Id: I0569e8d0a74ca647c5bcdba6c877e7374a89e6f9

packaging/capi-network-connection.spec
src/connection.c

index b16b8b4..4fbea54 100755 (executable)
@@ -1,6 +1,6 @@
 Name:          capi-network-connection
 Summary:       Network Connection library in TIZEN C API
-Version:       1.0.94
+Version:       1.0.95
 Release:       1
 Group:         System/Network
 License:       Apache-2.0
index 3901e2e..9a736f2 100755 (executable)
@@ -382,7 +382,8 @@ static int __connection_set_ethernet_cable_state_changed_cb(connection_h connect
                                        __connection_cb_ethernet_cable_state_changed_cb);
 
        } else {
-               if (__connection_get_ethernet_cable_state_changed_callback_count() == 1)
+               if (__connection_get_ethernet_cable_state_changed_callback_count() == 1 &&
+                                 local_handle->ethernet_cable_state_changed_callback)
                        _connection_libnet_set_ethernet_cable_state_changed_cb(NULL);
        }
 
@@ -616,7 +617,7 @@ EXPORT_API int connection_get_mac_address(connection_h connection, connection_ty
 
                break;
        //LCOV_EXCL_STOP
-       default :
+       default:
                CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
                return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }