[evolution-data-server] Bug #704220 - Incorrect runtime check in e_data_cal_respond_send_objects()
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug #704220 - Incorrect runtime check in e_data_cal_respond_send_objects()
- Date: Tue, 16 Jul 2013 07:02:20 +0000 (UTC)
commit 9da18738a150915500a44e0e7c54d9ef1eb4f3c4
Author: Milan Crha <mcrha redhat com>
Date: Tue Jul 16 09:01:55 2013 +0200
Bug #704220 - Incorrect runtime check in e_data_cal_respond_send_objects()
calendar/libedata-cal/e-cal-backend.c | 36 +++++++++++++++-----------------
calendar/libedata-cal/e-cal-backend.h | 4 +-
calendar/libedata-cal/e-data-cal.c | 28 ++++++++++---------------
3 files changed, 30 insertions(+), 38 deletions(-)
---
diff --git a/calendar/libedata-cal/e-cal-backend.c b/calendar/libedata-cal/e-cal-backend.c
index e1114a0..5c13393 100644
--- a/calendar/libedata-cal/e-cal-backend.c
+++ b/calendar/libedata-cal/e-cal-backend.c
@@ -3058,19 +3058,18 @@ e_cal_backend_receive_objects_finish (ECalBackend *backend,
*
* Sends meeting information in @calobj. The @backend may modify @calobj
* and send meeting information only to particular users. The function
- * returns the sent #ECalComponent and deposits the list of users the
- * meeting information was sent to in @out_users.
+ * returns the (maybe) modified @calobj and deposits the list of users the
+ * meeting information was sent (to be send) to in @out_users.
*
- * The returned #ECalComponent is referenced for thread-safety and must
- * be unrefenced with g_object_unref() when finished with it.
+ * The returned pointer should be freed with g_free(), when no londer needed.
*
* If an error occurs, the function will set @error and return %NULL.
*
- * Returns: an #ECalComponent, or %NULL
+ * Returns: a vCalendar string, or %NULL
*
* Since: 3.10
**/
-ECalComponent *
+gchar *
e_cal_backend_send_objects_sync (ECalBackend *backend,
const gchar *calobj,
GQueue *out_users,
@@ -3079,7 +3078,7 @@ e_cal_backend_send_objects_sync (ECalBackend *backend,
{
EAsyncClosure *closure;
GAsyncResult *result;
- ECalComponent *component;
+ gchar *out_calobj;
g_return_val_if_fail (E_IS_CAL_BACKEND (backend), NULL);
g_return_val_if_fail (calobj != NULL, NULL);
@@ -3092,12 +3091,12 @@ e_cal_backend_send_objects_sync (ECalBackend *backend,
result = e_async_closure_wait (closure);
- component = e_cal_backend_send_objects_finish (
+ out_calobj = e_cal_backend_send_objects_finish (
backend, result, out_users, error);
e_async_closure_free (closure);
- return component;
+ return out_calobj;
}
/* Helper for e_cal_backend_send_objects() */
@@ -3201,19 +3200,19 @@ e_cal_backend_send_objects (ECalBackend *backend,
*
* Finishes the operation started with e_cal_backend_send_objects().
*
- * The function returns the sent #ECalComponent and deposits the list of
- * users the meeting information was sent to in @out_users.
+ * The function returns a string representation of a sent, or to be send,
+ * vCalendar and deposits the list of users the meeting information was sent
+ * to, or to be send to, in @out_users.
*
- * The returned #ECalComponent is referenced for thread-safety and must
- * be unreferenced with g_object_unref() when finished with it.
+ * Free the returned pointer with g_free(), when no longer needed.
*
* If an error occurs, the function will set @error and return %NULL.
*
- * Returns: an #ECalComponent, or %NULL
+ * Returns: a newly allocated vCalendar string, or %NULL
*
* Since: 3.10
**/
-ECalComponent *
+gchar *
e_cal_backend_send_objects_finish (ECalBackend *backend,
GAsyncResult *result,
GQueue *out_users,
@@ -3221,7 +3220,7 @@ e_cal_backend_send_objects_finish (ECalBackend *backend,
{
GSimpleAsyncResult *simple;
AsyncContext *async_context;
- ECalComponent *component;
+ gchar *calobj;
g_return_val_if_fail (
g_simple_async_result_is_valid (
@@ -3237,12 +3236,11 @@ e_cal_backend_send_objects_finish (ECalBackend *backend,
if (g_simple_async_result_propagate_error (simple, error))
return NULL;
- component = g_queue_pop_head (&async_context->result_queue);
- g_return_val_if_fail (E_IS_CAL_COMPONENT (component), NULL);
+ calobj = g_queue_pop_head (&async_context->result_queue);
e_queue_transfer (&async_context->result_queue, out_users);
- return component;
+ return calobj;
}
/**
diff --git a/calendar/libedata-cal/e-cal-backend.h b/calendar/libedata-cal/e-cal-backend.h
index 5e8dc2f..e45dc27 100644
--- a/calendar/libedata-cal/e-cal-backend.h
+++ b/calendar/libedata-cal/e-cal-backend.h
@@ -373,7 +373,7 @@ gboolean e_cal_backend_receive_objects_finish
(ECalBackend *backend,
GAsyncResult *result,
GError **error);
-ECalComponent * e_cal_backend_send_objects_sync (ECalBackend *backend,
+gchar * e_cal_backend_send_objects_sync (ECalBackend *backend,
const gchar *calobj,
GQueue *out_users,
GCancellable *cancellable,
@@ -383,7 +383,7 @@ void e_cal_backend_send_objects (ECalBackend *backend,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
-ECalComponent * e_cal_backend_send_objects_finish
+gchar * e_cal_backend_send_objects_finish
(ECalBackend *backend,
GAsyncResult *result,
GQueue *out_users,
diff --git a/calendar/libedata-cal/e-data-cal.c b/calendar/libedata-cal/e-data-cal.c
index 325845d..9f718d2 100644
--- a/calendar/libedata-cal/e-data-cal.c
+++ b/calendar/libedata-cal/e-data-cal.c
@@ -1075,22 +1075,21 @@ data_cal_complete_send_objects_cb (GObject *source_object,
gpointer user_data)
{
AsyncContext *async_context = user_data;
- ECalComponent *component;
+ gchar *calobj;
GQueue queue = G_QUEUE_INIT;
GError *error = NULL;
- component = e_cal_backend_send_objects_finish (
+ calobj = e_cal_backend_send_objects_finish (
E_CAL_BACKEND (source_object), result, &queue, &error);
/* Sanity check. */
g_return_if_fail (
- ((component != NULL) && (error == NULL)) ||
- ((component == NULL) && (error != NULL)));
+ ((calobj != NULL) && (error == NULL)) ||
+ ((calobj == NULL) && (error != NULL)));
- if (component != NULL) {
+ if (calobj != NULL) {
gchar **strv;
- gchar *string;
- gchar *utf8_string;
+ gchar *utf8_calobj;
gint ii = 0;
strv = g_new0 (gchar *, queue.length + 1);
@@ -1103,17 +1102,16 @@ data_cal_complete_send_objects_cb (GObject *source_object,
g_free (user);
}
- string = e_cal_component_get_as_string (component);
- utf8_string = e_util_utf8_make_valid (string);
+ utf8_calobj = e_util_utf8_make_valid (calobj);
e_dbus_calendar_complete_send_objects (
async_context->interface,
async_context->invocation,
(const gchar * const *) strv,
- utf8_string);
+ utf8_calobj);
- g_free (utf8_string);
- g_free (string);
+ g_free (utf8_calobj);
+ g_free (calobj);
g_strfreev (strv);
} else {
@@ -2003,13 +2001,9 @@ e_data_cal_respond_send_objects (EDataCal *cal,
g_prefix_error (&error, "%s", _("Cannot send calendar objects: "));
if (error == NULL) {
- ECalComponent *component;
GSList *list, *link;
- component = e_cal_component_new_from_string (calobj);
- g_return_if_fail (component != NULL);
- g_queue_push_tail (queue, g_object_ref (component));
- g_object_unref (component);
+ g_queue_push_tail (queue, g_strdup (calobj));
list = (GSList *) users;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]