import evolution-data-server-3.28.5-9.el8

This commit is contained in:
CentOS Sources 2019-05-07 09:43:05 -04:00 committed by Andrew Lukoshko
commit c62d5d925c
10 changed files with 2872 additions and 0 deletions

View File

@ -0,0 +1 @@
85025da5aeda52b9bb9506cb89c7985d1cb9083c SOURCES/evolution-data-server-3.28.5.tar.xz

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/evolution-data-server-3.28.5.tar.xz

View File

@ -0,0 +1,24 @@
diff -up evolution-data-server-3.28.5/src/addressbook/backends/webdav/e-book-backend-webdav.c.dav-online-load-href evolution-data-server-3.28.5/src/addressbook/backends/webdav/e-book-backend-webdav.c
--- evolution-data-server-3.28.5/src/addressbook/backends/webdav/e-book-backend-webdav.c.dav-online-load-href 2018-11-26 12:18:57.874823757 +0100
+++ evolution-data-server-3.28.5/src/addressbook/backends/webdav/e-book-backend-webdav.c 2018-11-26 12:20:27.967822511 +0100
@@ -993,6 +993,8 @@ ebb_webdav_load_contact_sync (EBookMetaB
if (!*out_contact) {
success = FALSE;
g_propagate_error (&local_error, EDB_ERROR_EX (E_DATA_BOOK_STATUS_OTHER_ERROR, _("Received object is not a valid vCard")));
+ } else if (out_extra) {
+ *out_extra = g_strdup (href);
}
}
diff -up evolution-data-server-3.28.5/src/calendar/backends/caldav/e-cal-backend-caldav.c.dav-online-load-href evolution-data-server-3.28.5/src/calendar/backends/caldav/e-cal-backend-caldav.c
--- evolution-data-server-3.28.5/src/calendar/backends/caldav/e-cal-backend-caldav.c.dav-online-load-href 2018-11-26 12:19:15.809823509 +0100
+++ evolution-data-server-3.28.5/src/calendar/backends/caldav/e-cal-backend-caldav.c 2018-11-26 12:20:03.976822843 +0100
@@ -1135,6 +1135,8 @@ ecb_caldav_load_component_sync (ECalMeta
if (!*out_component) {
success = FALSE;
g_propagate_error (&local_error, EDC_ERROR (InvalidObject));
+ } else if (out_extra) {
+ *out_extra = g_strdup (href);
}
}

View File

@ -0,0 +1,34 @@
diff -up evolution-data-server-3.28.5/src/addressbook/backends/webdav/e-book-backend-webdav.c.dav-remove-ignores-not-found evolution-data-server-3.28.5/src/addressbook/backends/webdav/e-book-backend-webdav.c
--- evolution-data-server-3.28.5/src/addressbook/backends/webdav/e-book-backend-webdav.c.dav-remove-ignores-not-found 2018-11-28 14:31:11.278711852 +0100
+++ evolution-data-server-3.28.5/src/addressbook/backends/webdav/e-book-backend-webdav.c 2018-11-28 14:32:38.231710649 +0100
@@ -1160,6 +1160,13 @@ ebb_webdav_remove_contact_sync (EBookMet
g_object_unref (contact);
g_free (etag);
+ /* Ignore not found errors, this was a delete and the resource is gone.
+ It can be that it had been deleted on the server by other application. */
+ if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_NOT_FOUND)) {
+ g_clear_error (&local_error);
+ success = TRUE;
+ }
+
if (local_error) {
ebb_webdav_check_credentials_error (bbdav, webdav, local_error);
g_propagate_error (error, local_error);
diff -up evolution-data-server-3.28.5/src/calendar/backends/caldav/e-cal-backend-caldav.c.dav-remove-ignores-not-found evolution-data-server-3.28.5/src/calendar/backends/caldav/e-cal-backend-caldav.c
--- evolution-data-server-3.28.5/src/calendar/backends/caldav/e-cal-backend-caldav.c.dav-remove-ignores-not-found 2018-11-28 14:30:52.299712114 +0100
+++ evolution-data-server-3.28.5/src/calendar/backends/caldav/e-cal-backend-caldav.c 2018-11-28 14:31:11.279711852 +0100
@@ -1320,6 +1320,13 @@ ecb_caldav_remove_component_sync (ECalMe
icalcomponent_free (icalcomp);
g_free (etag);
+ /* Ignore not found errors, this was a delete and the resource is gone.
+ It can be that it had been deleted on the server by other application. */
+ if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_NOT_FOUND)) {
+ g_clear_error (&local_error);
+ success = TRUE;
+ }
+
if (local_error) {
ecb_caldav_check_credentials_error (cbdav, webdav, local_error);
g_propagate_error (error, local_error);

View File

@ -0,0 +1,55 @@
From 6022b2b7816fea84919eef5993363f636bf734dc Mon Sep 17 00:00:00 2001
From: Milan Crha <mcrha@redhat.com>
Date: Mon, 3 Sep 2018 09:43:50 +0200
Subject: evo-I#86 - Quoting of plain text mail into HTML mode mangles deeper
levels
Related to https://gitlab.gnome.org/GNOME/evolution/issues/86
diff --git a/src/camel/camel-mime-filter-tohtml.c b/src/camel/camel-mime-filter-tohtml.c
index 07024aa1a..df6283655 100644
--- a/src/camel/camel-mime-filter-tohtml.c
+++ b/src/camel/camel-mime-filter-tohtml.c
@@ -303,6 +303,7 @@ html_convert (CamelMimeFilter *mime_filter,
outend = mime_filter->outbuf + mime_filter->outsize;
if (priv->flags & CAMEL_MIME_FILTER_TOHTML_PRE && !priv->pre_open) {
+ outptr = check_size (mime_filter, outptr, &outend, 6);
outptr = g_stpcpy (outptr, "<pre>");
priv->pre_open = TRUE;
}
@@ -339,13 +340,13 @@ html_convert (CamelMimeFilter *mime_filter,
depth = citation_depth (start, inend, &skip);
while (priv->blockquote_depth < depth) {
- outptr = check_size (mime_filter, outptr, &outend, 30);
- outptr = g_stpcpy (outptr, "<blockquote type=\"cite\">\n");
+ outptr = check_size (mime_filter, outptr, &outend, 25);
+ outptr = g_stpcpy (outptr, "<blockquote type=\"cite\">");
priv->blockquote_depth++;
}
while (priv->blockquote_depth > depth) {
- outptr = check_size (mime_filter, outptr, &outend, 15);
- outptr = g_stpcpy (outptr, "</blockquote>\n");
+ outptr = check_size (mime_filter, outptr, &outend, 14);
+ outptr = g_stpcpy (outptr, "</blockquote>");
priv->blockquote_depth--;
}
#if FOOLISHLY_UNMUNGE_FROM
@@ -463,14 +464,14 @@ html_convert (CamelMimeFilter *mime_filter,
outptr, &outend);
while (priv->blockquote_depth > 0) {
- outptr = check_size (mime_filter, outptr, &outend, 15);
+ outptr = check_size (mime_filter, outptr, &outend, 14);
outptr = g_stpcpy (outptr, "</blockquote>");
priv->blockquote_depth--;
}
if (priv->pre_open) {
/* close the pre-tag */
- outptr = check_size (mime_filter, outptr, &outend, 10);
+ outptr = check_size (mime_filter, outptr, &outend, 7);
outptr = g_stpcpy (outptr, "</pre>");
priv->pre_open = FALSE;
}

View File

@ -0,0 +1,55 @@
From 5eaebbe5c1fd81baf93c2f8d3aeafa49abc92af6 Mon Sep 17 00:00:00 2001
From: Milan Crha <mcrha@redhat.com>
Date: Tue, 13 Nov 2018 10:36:37 +0100
Subject: test-cal-client-get-revision could fail due to delayed D-Bus property
change notification
The test had been mostly working, except cases when the delivery
of a D-Bus property change signal had been delayed. Then the value
on the client side was not the same as the value on the server side.
There's a very similar test for EBookClient, which does slightly more
things, which gives D-Bus enough time to deliver the property change
to the client, thus this change adds the component removal to address it.
diff --git a/tests/libebook/client/test-book-client-get-revision.c b/tests/libebook/client/test-book-client-get-revision.c
index 601c5e8c5..8995f0659 100644
--- a/tests/libebook/client/test-book-client-get-revision.c
+++ b/tests/libebook/client/test-book-client-get-revision.c
@@ -50,7 +50,7 @@ get_revision_compare_cycle (EBookClient *client)
g_assert (revision_before);
g_assert (revision_after);
- g_assert (strcmp (revision_before, revision_after) != 0);
+ g_assert_cmpstr (revision_before, !=, revision_after);
g_message (
"Passed cycle, revision before '%s' revision after '%s'",
diff --git a/tests/libecal/client/test-cal-client-get-revision.c b/tests/libecal/client/test-cal-client-get-revision.c
index 305f15f0b..96887a360 100644
--- a/tests/libecal/client/test-cal-client-get-revision.c
+++ b/tests/libecal/client/test-cal-client-get-revision.c
@@ -42,18 +42,21 @@ get_revision_compare_cycle (ECalClient *client)
if (!e_client_get_backend_property_sync (E_CLIENT (client), CLIENT_BACKEND_PROPERTY_REVISION,
&revision_before, NULL, &error))
- g_error ("Error getting book revision: %s", error->message);
+ g_error ("Error getting calendar revision: %s", error->message);
if (!e_cal_client_create_object_sync (client, icalcomp, &uid, NULL, &error))
g_error ("Error creating object: %s", error->message);
+ if (!e_cal_client_remove_object_sync (client, uid, NULL, E_CAL_OBJ_MOD_ALL, NULL, &error))
+ g_error ("Error removing created object: %s", error->message);
+
if (!e_client_get_backend_property_sync (E_CLIENT (client), CLIENT_BACKEND_PROPERTY_REVISION,
&revision_after, NULL, &error))
- g_error ("Error getting book revision: %s", error->message);
+ g_error ("Error getting calendar revision: %s", error->message);
g_assert (revision_before);
g_assert (revision_after);
- g_assert (strcmp (revision_before, revision_after) != 0);
+ g_assert_cmpstr (revision_before, !=, revision_after);
g_message (
"Passed cycle, revision before '%s' revision after '%s'",

View File

@ -0,0 +1,341 @@
diff -up evolution-data-server-3.28.5/src/libebackend/e-data-factory.c.tests-retry-client-open evolution-data-server-3.28.5/src/libebackend/e-data-factory.c
--- evolution-data-server-3.28.5/src/libebackend/e-data-factory.c.tests-retry-client-open 2018-07-30 15:17:06.000000000 +0200
+++ evolution-data-server-3.28.5/src/libebackend/e-data-factory.c 2018-12-04 10:42:29.837599599 +0100
@@ -1278,6 +1278,13 @@ data_factory_spawn_subprocess_backend (E
priv = data_factory->priv;
source = e_source_registry_ref_source (priv->registry, uid);
+
+ if (!source) {
+ g_set_error (
+ &error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+ _("No such source for UID “%s”"), uid);
+ }
+
if (source && e_source_has_extension (source, extension_name)) {
ESourceBackend *extension;
@@ -1372,7 +1379,7 @@ data_factory_spawn_subprocess_backend (E
NULL);
g_object_unref (subprocess);
- } else {
+ } else if (!error) {
error = g_error_new (G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("Backend factory for source “%s” and extension “%s” cannot be found."),
uid, extension_name);
diff -up evolution-data-server-3.28.5/tests/libecal/client/test-cal-client-get-free-busy.c.tests-retry-client-open evolution-data-server-3.28.5/tests/libecal/client/test-cal-client-get-free-busy.c
--- evolution-data-server-3.28.5/tests/libecal/client/test-cal-client-get-free-busy.c.tests-retry-client-open 2018-12-04 10:43:10.449599037 +0100
+++ evolution-data-server-3.28.5/tests/libecal/client/test-cal-client-get-free-busy.c 2018-12-04 10:43:19.837598907 +0100
@@ -94,6 +94,49 @@ teardown_fixture (ETestServerFixture *fi
}
static void
+add_component_sync (ECalClient *cal_client)
+{
+ const gchar *comp_str =
+ "BEGIN:VEVENT\r\n"
+ "UID:test-fb-event-1\r\n"
+ "DTSTAMP:20040212T000000Z\r\n"
+ "DTSTART:20040213T060000Z\r\n"
+ "DTEND:20040213T080000Z\r\n"
+ "SUMMARY:Test event\r\n"
+ "TRANSP:OPAQUE\r\n"
+ "CLASS:PUBLIC\r\n"
+ "CREATED:20040211T080000Z\r\n"
+ "LAST-MODIFIED:20040211T080000Z\r\n"
+ "END:VEVENT\r\n";
+ icalcomponent *icalcomp;
+ GError *error = NULL;
+
+ icalcomp = icalcomponent_new_from_string (comp_str);
+ g_assert_nonnull (icalcomp);
+
+ if (!e_cal_client_create_object_sync (cal_client, icalcomp, NULL, NULL, &error))
+ g_error ("Failed to add component: %s", error ? error->message : "Unknown error");
+
+ icalcomponent_free (icalcomp);
+ g_clear_error (&error);
+}
+
+static void
+wait_for_dbus_signal (GMainLoop *loop)
+{
+ GMainContext *main_context;
+ gint retries = 0;
+
+ main_context = g_main_loop_get_context (loop);
+
+ while (!received_free_busy_data && retries < 5) {
+ retries++;
+
+ g_main_context_iteration (main_context, TRUE);
+ }
+}
+
+static void
free_busy_data_cb (ECalClient *client,
const GSList *free_busy,
const gchar *func_name)
@@ -114,9 +157,13 @@ test_get_free_busy_sync (ETestServerFixt
cal_client = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient);
+ add_component_sync (cal_client);
+
/* This is set by the free-busy-data callback */
received_free_busy_data = FALSE;
+ g_signal_connect (cal_client, "free-busy-data", G_CALLBACK (free_busy_data_cb), (gpointer) G_STRFUNC);
+
utc = icaltimezone_get_utc_timezone ();
start = time_from_isodate ("20040212T000000Z");
end = time_add_day_with_zone (start, 2, utc);
@@ -127,6 +174,9 @@ test_get_free_busy_sync (ETestServerFixt
g_slist_free (users);
+ wait_for_dbus_signal (fixture->loop);
+
+ g_assert (received_free_busy_data);
g_assert (freebusy_data);
g_slist_free_full (freebusy_data, g_object_unref);
@@ -147,6 +197,8 @@ async_get_free_busy_result_ready (GObjec
if (!e_cal_client_get_free_busy_finish (cal_client, result, &freebusy_data, &error))
g_error ("create object finish: %s", error->message);
+ wait_for_dbus_signal (loop);
+
g_assert (received_free_busy_data);
g_assert (freebusy_data);
@@ -166,6 +218,8 @@ test_get_free_busy_async (ETestServerFix
cal_client = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient);
+ add_component_sync (cal_client);
+
/* This is set by the free-busy-data callback */
received_free_busy_data = FALSE;
diff -up evolution-data-server-3.28.5/tests/test-server-utils/e-test-server-utils.c.tests-retry-client-open evolution-data-server-3.28.5/tests/test-server-utils/e-test-server-utils.c
--- evolution-data-server-3.28.5/tests/test-server-utils/e-test-server-utils.c.tests-retry-client-open 2018-07-30 15:17:06.000000000 +0200
+++ evolution-data-server-3.28.5/tests/test-server-utils/e-test-server-utils.c 2018-12-04 10:43:19.838598907 +0100
@@ -199,6 +199,7 @@ assert_object_finalized (ETestServerFixt
typedef struct {
ETestServerFixture *fixture;
ETestServerClosure *closure;
+ guint retries;
} FixturePair;
static gboolean
@@ -332,12 +333,15 @@ e_test_server_utils_bootstrap_timeout (F
return FALSE;
}
+static gboolean e_test_server_utils_retry_open_client_cb (gpointer user_data);
+
static void
e_test_server_utils_client_ready (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
FixturePair *pair = (FixturePair *) user_data;
+ gboolean need_retry = FALSE;
GError *error = NULL;
switch (pair->closure->type) {
@@ -345,7 +349,10 @@ e_test_server_utils_client_ready (GObjec
pair->fixture->service.book_client = (EBookClient *)
e_book_client_connect_finish (res, &error);
- if (!pair->fixture->service.book_client)
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND) &&
+ pair->retries < 3)
+ need_retry = TRUE;
+ else if (!pair->fixture->service.book_client)
g_error ("Unable to create the test book: %s", error->message);
break;
@@ -353,7 +360,10 @@ e_test_server_utils_client_ready (GObjec
pair->fixture->service.book_client = (EBookClient *)
e_book_client_connect_direct_finish (res, &error);
- if (!pair->fixture->service.book_client)
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND) &&
+ pair->retries < 3)
+ need_retry = TRUE;
+ else if (!pair->fixture->service.book_client)
g_error ("Unable to create the test book: %s", error->message);
break;
@@ -361,7 +371,10 @@ e_test_server_utils_client_ready (GObjec
pair->fixture->service.calendar_client = (ECalClient *)
e_cal_client_connect_finish (res, &error);
- if (!pair->fixture->service.calendar_client)
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND) &&
+ pair->retries < 3)
+ need_retry = TRUE;
+ else if (!pair->fixture->service.calendar_client)
g_error ("Unable to create the test calendar: %s", error->message);
break;
@@ -371,6 +384,14 @@ e_test_server_utils_client_ready (GObjec
g_assert_not_reached ();
}
+ g_clear_error (&error);
+
+ if (need_retry) {
+ pair->retries++;
+ g_timeout_add_seconds (1, e_test_server_utils_retry_open_client_cb, pair);
+ return;
+ }
+
/* Track ref counts now that we have a client */
add_weak_ref (pair->fixture, pair->closure->type);
@@ -382,6 +403,7 @@ e_test_server_utils_source_added (ESourc
ESource *source,
FixturePair *pair)
{
+ gboolean need_retry = FALSE;
GError *error = NULL;
if (g_strcmp0 (e_source_get_uid (source), pair->fixture->source_name) != 0)
@@ -409,8 +431,13 @@ e_test_server_utils_source_added (ESourc
}
if (!pair->closure->use_async_connect &&
- !pair->fixture->service.book_client)
- g_error ("Unable to create the test book: %s", error ? error->message : "Unknown error");
+ !pair->fixture->service.book_client) {
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND) &&
+ pair->retries < 3)
+ need_retry = TRUE;
+ else
+ g_error ("Unable to create the test book: %s", error ? error->message : "Unknown error");
+ }
break;
@@ -418,11 +445,23 @@ e_test_server_utils_source_added (ESourc
/* Dont bother testing the Async apis for deprecated APIs */
pair->fixture->service.book = e_book_new (source, &error);
- if (!pair->fixture->service.book)
- g_error ("Unable to create the test book: %s", error->message);
+ if (!pair->fixture->service.book) {
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND) &&
+ pair->retries < 3)
+ need_retry = TRUE;
+ else
+ g_error ("Unable to create the test book: %s", error->message);
+
+ break;
+ }
- if (!e_book_open (pair->fixture->service.book, FALSE, &error))
- g_error ("Unable to open book: %s", error->message);
+ if (!e_book_open (pair->fixture->service.book, FALSE, &error)) {
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND) &&
+ pair->retries < 3)
+ need_retry = TRUE;
+ else
+ g_error ("Unable to open book: %s", error->message);
+ }
break;
@@ -439,8 +478,13 @@ e_test_server_utils_source_added (ESourc
e_cal_client_connect_sync (
source,
pair->closure->calendar_source_type, (guint32) -1, NULL, &error);
- if (!pair->fixture->service.calendar_client)
- g_error ("Unable to create the test calendar: %s", error->message);
+ if (!pair->fixture->service.calendar_client) {
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND) &&
+ pair->retries < 3)
+ need_retry = TRUE;
+ else
+ g_error ("Unable to create the test calendar: %s", error->message);
+ }
}
break;
@@ -449,11 +493,22 @@ e_test_server_utils_source_added (ESourc
/* Dont bother testing the Async apis for deprecated APIs */
pair->fixture->service.calendar = e_cal_new (source, pair->closure->calendar_source_type);
- if (!pair->fixture->service.calendar)
- g_error ("Unable to create the test calendar");
+ if (!pair->fixture->service.calendar) {
+ if (pair->retries < 3)
+ need_retry = TRUE;
+ else
+ g_error ("Unable to create the test calendar");
- if (!e_cal_open (pair->fixture->service.calendar, FALSE, &error))
- g_error ("Unable to open calendar: %s", error->message);
+ break;
+ }
+
+ if (!e_cal_open (pair->fixture->service.calendar, FALSE, &error)) {
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND) &&
+ pair->retries < 3)
+ need_retry = TRUE;
+ else
+ g_error ("Unable to open calendar: %s", error->message);
+ }
break;
@@ -461,6 +516,14 @@ e_test_server_utils_source_added (ESourc
return;
}
+ g_clear_error (&error);
+
+ if (need_retry) {
+ pair->retries++;
+ g_timeout_add_seconds (1, e_test_server_utils_retry_open_client_cb, pair);
+ return;
+ }
+
/* Add the weak ref now if we just created it */
if (pair->closure->type != E_TEST_SERVER_NONE &&
pair->closure->use_async_connect == FALSE)
@@ -471,6 +534,22 @@ e_test_server_utils_source_added (ESourc
}
static gboolean
+e_test_server_utils_retry_open_client_cb (gpointer user_data)
+{
+ FixturePair *pair = user_data;
+ ESource *source;
+
+ source = e_source_registry_ref_source (pair->fixture->registry, pair->fixture->source_name);
+
+ g_assert (E_IS_SOURCE (source));
+
+ e_test_server_utils_source_added (pair->fixture->registry, source, pair);
+ g_object_unref (source);
+
+ return FALSE;
+}
+
+static gboolean
e_test_server_utils_bootstrap_idle (FixturePair *pair)
{
ESourceBackend *backend = NULL;
@@ -578,7 +657,7 @@ e_test_server_utils_setup (ETestServerFi
gconstpointer user_data)
{
ETestServerClosure *closure = (ETestServerClosure *) user_data;
- FixturePair pair = { fixture, closure };
+ FixturePair pair = { fixture, closure, 0 };
/* Create work directory */
if (!test_installed_services ())

View File

@ -0,0 +1,179 @@
diff --git a/src/addressbook/libebook-contacts/e-vcard.c b/src/addressbook/libebook-contacts/e-vcard.c
index e44b7fdcf..680cf85af 100644
--- a/src/addressbook/libebook-contacts/e-vcard.c
+++ b/src/addressbook/libebook-contacts/e-vcard.c
@@ -120,6 +120,14 @@
G_DEFINE_TYPE (EVCard, e_vcard, G_TYPE_OBJECT)
+static EVCardAttribute *e_vcard_attribute_ref (EVCardAttribute *attr);
+static void e_vcard_attribute_unref (EVCardAttribute *attr);
+static EVCardAttributeParam *e_vcard_attribute_param_ref (EVCardAttributeParam *param);
+static void e_vcard_attribute_param_unref (EVCardAttributeParam *param);
+
+G_DEFINE_BOXED_TYPE (EVCardAttribute, e_vcard_attribute, e_vcard_attribute_ref, e_vcard_attribute_unref)
+G_DEFINE_BOXED_TYPE (EVCardAttributeParam, e_vcard_attribute_param, e_vcard_attribute_param_ref, e_vcard_attribute_param_unref)
+
/* Encoding used in v-card
* Note: v-card spec defines additional 7BIT 8BIT and X- encoding
*/
@@ -135,6 +143,7 @@ struct _EVCardPrivate {
};
struct _EVCardAttribute {
+ gint ref_count;
gchar *group;
gchar *name;
GList *params; /* EVCardParam */
@@ -145,6 +154,7 @@ struct _EVCardAttribute {
};
struct _EVCardAttributeParam {
+ gint ref_count;
gchar *name;
GList *values; /* GList of gchar *'s */
};
@@ -1555,6 +1565,7 @@ e_vcard_attribute_new (const gchar *attr_group,
if (attr_group != NULL && *attr_group == '\0')
attr_group = NULL;
+ attr->ref_count = 1;
attr->group = g_strdup (attr_group);
attr->name = g_strdup (attr_name);
@@ -1572,14 +1583,34 @@ e_vcard_attribute_free (EVCardAttribute *attr)
{
g_return_if_fail (attr != NULL);
- g_free (attr->group);
- g_free (attr->name);
+ e_vcard_attribute_unref (attr);
+}
- e_vcard_attribute_remove_values (attr);
+static EVCardAttribute *
+e_vcard_attribute_ref (EVCardAttribute *attr)
+{
+ g_return_val_if_fail (attr != NULL, NULL);
- e_vcard_attribute_remove_params (attr);
+ g_atomic_int_inc (&attr->ref_count);
- g_slice_free (EVCardAttribute, attr);
+ return attr;
+}
+
+static void
+e_vcard_attribute_unref (EVCardAttribute *attr)
+{
+ g_return_if_fail (attr != NULL);
+
+ if (g_atomic_int_dec_and_test (&attr->ref_count)) {
+ g_free (attr->group);
+ g_free (attr->name);
+
+ e_vcard_attribute_remove_values (attr);
+
+ e_vcard_attribute_remove_params (attr);
+
+ g_slice_free (EVCardAttribute, attr);
+ }
}
/**
@@ -1609,25 +1640,6 @@ e_vcard_attribute_copy (EVCardAttribute *attr)
return a;
}
-GType
-e_vcard_attribute_get_type (void)
-{
- static volatile gsize type_id__volatile = 0;
-
- if (g_once_init_enter (&type_id__volatile)) {
- GType type_id;
-
- type_id = g_boxed_type_register_static (
- "EVCardAttribute",
- (GBoxedCopyFunc) e_vcard_attribute_copy,
- (GBoxedFreeFunc) e_vcard_attribute_free);
-
- g_once_init_leave (&type_id__volatile, type_id);
- }
-
- return type_id__volatile;
-}
-
/**
* e_vcard_remove_attributes:
* @evc: vcard object
@@ -2068,25 +2080,6 @@ e_vcard_attribute_remove_params (EVCardAttribute *attr)
attr->encoding = EVC_ENCODING_RAW;
}
-GType
-e_vcard_attribute_param_get_type (void)
-{
- static volatile gsize type_id__volatile = 0;
-
- if (g_once_init_enter (&type_id__volatile)) {
- GType type_id;
-
- type_id = g_boxed_type_register_static (
- "EVCardAttributeParam",
- (GBoxedCopyFunc) e_vcard_attribute_param_copy,
- (GBoxedFreeFunc) e_vcard_attribute_param_free);
-
- g_once_init_leave (&type_id__volatile, type_id);
- }
-
- return type_id__volatile;
-}
-
/**
* e_vcard_attribute_param_new:
* @name: the name of the new parameter
@@ -2099,6 +2092,8 @@ EVCardAttributeParam *
e_vcard_attribute_param_new (const gchar *name)
{
EVCardAttributeParam *param = g_slice_new (EVCardAttributeParam);
+
+ param->ref_count = 1;
param->values = NULL;
param->name = g_strdup (name);
@@ -2116,11 +2111,31 @@ e_vcard_attribute_param_free (EVCardAttributeParam *param)
{
g_return_if_fail (param != NULL);
- g_free (param->name);
+ e_vcard_attribute_param_unref (param);
+}
+
+static EVCardAttributeParam *
+e_vcard_attribute_param_ref (EVCardAttributeParam *param)
+{
+ g_return_val_if_fail (param != NULL, NULL);
+
+ g_atomic_int_inc (&param->ref_count);
+
+ return param;
+}
+
+static void
+e_vcard_attribute_param_unref (EVCardAttributeParam *param)
+{
+ g_return_if_fail (param != NULL);
+
+ if (g_atomic_int_dec_and_test (&param->ref_count)) {
+ g_free (param->name);
- e_vcard_attribute_param_remove_values (param);
+ e_vcard_attribute_param_remove_values (param);
- g_slice_free (EVCardAttributeParam, param);
+ g_slice_free (EVCardAttributeParam, param);
+ }
}
/**

View File

@ -0,0 +1,14 @@
diff --git a/src/addressbook/libebook-contacts/e-vcard.c b/src/addressbook/libebook-contacts/e-vcard.c
index f11a17d77..e44b7fdcf 100644
--- a/src/addressbook/libebook-contacts/e-vcard.c
+++ b/src/addressbook/libebook-contacts/e-vcard.c
@@ -2395,8 +2395,8 @@ e_vcard_attribute_remove_param_value (EVCardAttribute *attr,
return;
}
- param->values = g_list_delete_link (param->values, l);
g_free (l->data);
+ param->values = g_list_delete_link (param->values, l);
if (param->values == NULL) {
e_vcard_attribute_param_free (param);

File diff suppressed because it is too large Load Diff