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");
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);