Fixed issue which view uri table is deleted 04/125004/1 accepted/tizen/unified/20170414.042740 submit/tizen/20170413.235623
authorJeesun Kim <iamjs.kim@samsung.com>
Thu, 13 Apr 2017 08:57:50 +0000 (17:57 +0900)
committerJeesun Kim <iamjs.kim@samsung.com>
Thu, 13 Apr 2017 09:27:26 +0000 (18:27 +0900)
Change-Id: I6282c006f4d1aee93075fc35a9e6d2f75cbc1762

common/cal_filter.c
common/cal_query.c
common/cal_record.c

index 3fc63d4..2abfbd8 100644 (file)
@@ -42,13 +42,13 @@ EXPORT_API int calendar_filter_create(const char* view_uri, calendar_filter_h* o
 
        RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == out_filter, CALENDAR_ERROR_INVALID_PARAMETER);
+
        com_filter = calloc(1, sizeof(cal_composite_filter_s));
        RETV_IF(NULL == com_filter, CALENDAR_ERROR_OUT_OF_MEMORY);
 
 #ifdef CAL_IPC_CLIENT
        cal_view_initialize();
 #endif
-
        com_filter->filter_type = CAL_FILTER_COMPOSITE;
        com_filter->view_uri = cal_strdup(view_uri);
        com_filter->properties = (cal_property_info_s *)cal_view_get_property_info(view_uri, &com_filter->property_count);
index 915f511..47d4f61 100644 (file)
@@ -45,13 +45,12 @@ EXPORT_API int calendar_query_create(const char* view_uri, calendar_query_h* out
        RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == out_query, CALENDAR_ERROR_INVALID_PARAMETER);
 
-#ifdef CAL_IPC_CLIENT
-       cal_view_initialize();
-#endif
-
        query = calloc(1, sizeof(cal_query_s));
        RETV_IF(NULL == query, CALENDAR_ERROR_OUT_OF_MEMORY);
 
+#ifdef CAL_IPC_CLIENT
+       cal_view_initialize();
+#endif
        query->view_uri = cal_strdup(view_uri);
        query->properties = (cal_property_info_s *)cal_view_get_property_info(view_uri, &query->property_count);
        *out_query = (calendar_query_h)query;
index ceafc7a..700823a 100644 (file)
@@ -178,7 +178,6 @@ EXPORT_API int calendar_record_create(const char* view_uri, calendar_record_h* o
 #ifdef CAL_IPC_CLIENT
        cal_view_initialize();
 #endif
-
        type = cal_view_get_type(view_uri);
        RETV_IF(CAL_RECORD_TYPE_INVALID == type, CALENDAR_ERROR_INVALID_PARAMETER);
 
@@ -187,7 +186,6 @@ EXPORT_API int calendar_record_create(const char* view_uri, calendar_record_h* o
        RETVM_IF(NULL == plugin_cb->create, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted in [%s]", view_uri);
 
        ret = plugin_cb->create(out_record);
-
        if (CALENDAR_ERROR_NONE == ret)
                CAL_RECORD_INIT_COMMON((cal_record_s*)*out_record, type, plugin_cb, cal_view_get_uri(view_uri));
 
@@ -200,10 +198,6 @@ EXPORT_API int calendar_record_destroy(calendar_record_h record, bool delete_chi
 
        RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
 
-#ifdef CAL_IPC_CLIENT
-       cal_view_finalize();
-#endif
-
        cal_record_s *temp = (cal_record_s*)(record);
 
        RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
@@ -211,6 +205,9 @@ EXPORT_API int calendar_record_destroy(calendar_record_h record, bool delete_chi
 
        CAL_FREE(temp->properties_flags);
 
+#ifdef CAL_IPC_CLIENT
+       cal_view_finalize();
+#endif
        ret = temp->plugin_cb->destroy(record, delete_child);
 
        return ret;
@@ -227,6 +224,9 @@ EXPORT_API int calendar_record_clone(calendar_record_h record, calendar_record_h
        RETV_IF(NULL == out_record, CALENDAR_ERROR_INVALID_PARAMETER);
        RETVM_IF(NULL == temp->plugin_cb->clone, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted in [%s]", temp->view_uri);
 
+#ifdef CAL_IPC_CLIENT
+       cal_view_initialize();
+#endif
        ret = temp->plugin_cb->clone(record, out_record);
 
        return ret;