Add to check the error of signal subscribe 76/194176/1
authorjiyong.min <jiyong.min@samsung.com>
Thu, 29 Nov 2018 05:29:45 +0000 (14:29 +0900)
committerjiyong.min <jiyong.min@samsung.com>
Thu, 29 Nov 2018 05:32:35 +0000 (14:32 +0900)
Change-Id: I40d12aec304151927abe9814db677ab3ae537b88

packaging/capi-media-controller.spec
src/media_controller_ipc.c

index 10c2dfb..ba3edbb 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-controller
 Summary:    A media controller library in Tizen Native API
-Version:    0.1.76
+Version:    0.1.77
 Release:    1
 Group:      Multimedia/API
 License:    Apache-2.0
index e738387..ed67847 100755 (executable)
@@ -162,7 +162,6 @@ int mc_ipc_unref_dbus_connection(GDBusConnection *connection, int *dref_count)
 int mc_ipc_register_listener(GList **listener_list, GDBusConnection *connection, const char *interface_name, const char *signal_name, mc_signal_received_cb callback, void *user_data)
 {
        char *key = NULL;
-       guint handler = 0;
 
        mc_retvm_if(listener_list == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "listener_list is NULL");
        mc_retvm_if(connection == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "connection is NULL");
@@ -187,14 +186,19 @@ int mc_ipc_register_listener(GList **listener_list, GDBusConnection *connection,
                return MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORY;
        }
 
-       handler = _mc_ipc_signal_subscribe(connection, interface_name, signal_name, listener_list);
+       listener->handler = _mc_ipc_signal_subscribe(connection, interface_name, signal_name, listener_list);
+       if (listener->handler == 0) {
+               mc_error("Error signal subscribe");
+               MC_SAFE_G_FREE(key);
+               MC_SAFE_G_FREE(listener);
+               return MEDIA_CONTROLLER_ERROR_INVALID_OPERATION;
+       }
 
        listener->dbus_conn = connection;
        listener->interface_name = strdup(interface_name);
        listener->signal_name = strdup(signal_name);
        listener->callback = callback;
        listener->user_data = user_data;
-       listener->handler = handler;
        listener->key = key;
 
        (*listener_list) = g_list_append(*listener_list, listener);