After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 620554 - Adapt to GSettings API break
Adapt to GSettings API break
Status: RESOLVED FIXED
Product: gedit
Classification: Applications
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2010-06-04 09:35 UTC by Florian Müllner
Modified: 2010-06-04 12:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Adapt to GSettings API break (5.79 KB, patch)
2010-06-04 09:35 UTC, Florian Müllner
none Details | Review
Adapt to GSettings API break (5.88 KB, patch)
2010-06-04 10:36 UTC, Florian Müllner
none Details | Review

Description Florian Müllner 2010-06-04 09:35:39 UTC
See patch.
Comment 1 Florian Müllner 2010-06-04 09:35:42 UTC
Created attachment 162737 [details] [review]
Adapt to GSettings API break

The API for setting and retrieving string arrays was changed, so all
calls to g_settings_set_strv()/g_settings_get_strv() need adjusting.
Comment 2 Ignacio Casal Quinteiro (nacho) 2010-06-04 09:40:21 UTC
Review of attachment 162737 [details] [review]:

The patch looks mostly ok, but have you tested the patch? because probably the array now needs to be NULL terminated
as that wasn't needed before with the len argument.
Comment 3 Florian Müllner 2010-06-04 10:36:34 UTC
Created attachment 162740 [details] [review]
Adapt to GSettings API break

(In reply to comment #2)
> Review of attachment 162737 [details] [review]:
> The patch looks mostly ok, but have you tested the patch?

Sorry for not pointing that out - no, I didn't. I checked that
gedit compiles and runs, but I haven't gotten gsettings to work
yet.


> because probably the array now needs to be NULL terminated
> as that wasn't needed before with the len argument.

I'm not sure that this is truly a new requirement - the API
break was requested because according to the g-i annotations
the array was NULL-terminated and had its length encoded in the
len argument (just mentioning this here because IMO that's a
good justification for the break).


That said, you are right that one of the list_to_strv functions
managed to skip under my radar.

Attaching updated patch, interdiff for review convenience:

diff --git a/gedit/gedit-settings.c b/gedit/gedit-settings.c
index 6b278d4..d0eb84e 100644
--- a/gedit/gedit-settings.c
+++ b/gedit/gedit-settings.c
@@ -890,12 +890,13 @@ gedit_settings_set_list (GSettings    *settings,
 		gint i, len;
 
 		len = g_slist_length ((GSList *)list);
-		values = g_new (gchar *, len);
+		values = g_new (gchar *, len + 1);
 
 		for (l = list, i = 0; l != NULL; l = g_slist_next (l), i++)
 		{
 			values[i] = l->data;
 		}
+		values[i] = NULL;
 	}
 
 	g_settings_set_strv (settings, key, (const gchar * const *)values);
Comment 4 Ignacio Casal Quinteiro (nacho) 2010-06-04 12:04:56 UTC
Thanks, now the patch looks good. I've just pushed it.