[evolution-data-server/gnome-42] Check for non-zero value passed to g_flags_get_first_value()
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-42] Check for non-zero value passed to g_flags_get_first_value()
- Date: Mon, 18 Jul 2022 09:49:36 +0000 (UTC)
commit ede95546305a8bb7e7213c247132f07ca9074e25
Author: Milan Crha <mcrha redhat com>
Date: Mon Jul 18 10:09:12 2022 +0200
Check for non-zero value passed to g_flags_get_first_value()
When the value is zero, the flag removal does not do anything, which
leads to an infinite loop.
It is related to a GLib change:
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2576
This had been reported downstream:
https://bugzilla.redhat.com/show_bug.cgi?id=2107751
src/calendar/libecal/e-cal-client.c | 12 ++++++------
src/libedataserver/e-source.c | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/calendar/libecal/e-cal-client.c b/src/calendar/libecal/e-cal-client.c
index a861c27aa..d49a50a48 100644
--- a/src/calendar/libecal/e-cal-client.c
+++ b/src/calendar/libecal/e-cal-client.c
@@ -5187,13 +5187,13 @@ e_cal_client_modify_objects_sync (ECalClient *client,
mod_flags = g_string_new (NULL);
flags_class = g_type_class_ref (E_TYPE_CAL_OBJ_MOD_TYPE);
- flags_value = g_flags_get_first_value (flags_class, mod);
- while (flags_value != NULL) {
+ for (flags_value = g_flags_get_first_value (flags_class, mod);
+ flags_value && mod;
+ flags_value = g_flags_get_first_value (flags_class, mod)) {
if (mod_flags->len > 0)
g_string_append_c (mod_flags, ':');
g_string_append (mod_flags, flags_value->value_nick);
mod &= ~flags_value->value;
- flags_value = g_flags_get_first_value (flags_class, mod);
}
strv = g_new0 (gchar *, g_slist_length (icalcomps) + 1);
@@ -5549,13 +5549,13 @@ e_cal_client_remove_objects_sync (ECalClient *client,
mod_flags = g_string_new (NULL);
flags_class = g_type_class_ref (E_TYPE_CAL_OBJ_MOD_TYPE);
- flags_value = g_flags_get_first_value (flags_class, mod);
- while (flags_value != NULL) {
+ for (flags_value = g_flags_get_first_value (flags_class, mod);
+ flags_value && mod;
+ flags_value = g_flags_get_first_value (flags_class, mod)) {
if (mod_flags->len > 0)
g_string_append_c (mod_flags, ':');
g_string_append (mod_flags, flags_value->value_nick);
mod &= ~flags_value->value;
- flags_value = g_flags_get_first_value (flags_class, mod);
}
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ss)"));
diff --git a/src/libedataserver/e-source.c b/src/libedataserver/e-source.c
index 31d851e21..23b82f7b1 100644
--- a/src/libedataserver/e-source.c
+++ b/src/libedataserver/e-source.c
@@ -4622,7 +4622,7 @@ e_source_invoke_credentials_required_sync (ESource *source,
flags_class = g_type_class_ref (G_TYPE_TLS_CERTIFICATE_FLAGS);
for (flags_value = g_flags_get_first_value (flags_class, certificate_errors);
- flags_value;
+ flags_value && certificate_errors;
flags_value = g_flags_get_first_value (flags_class, certificate_errors)) {
if (certificate_errors_str->len)
g_string_append_c (certificate_errors_str, ':');
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]