! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Allow to store empty arrays
Status:
RESOLVED: FIXED
Product:
Xfconf
Component:
Libxfconf

Comments

Description Viktor Odintsev editbugs 2017-08-17 02:46:39 CEST
Created attachment 7272 
Allow to store empty arrays

xfconf 4.13.3 introduced an issue: applications now can't store empty GPtrArrays because it will be just ignored with warning:

> g_return_val_if_fail (arr && arr->len != 0, NULL);

Ignoring empty arrays won't also work because g_variant_builder_end won't work if you haven't added anything to GVariantBuilder.

I suggest to return an empty array of variants if arr->len == 0. I'm attaching the patch which does that.
Comment 1 Stefan Berzl 2017-08-19 01:24:30 CEST
Created attachment 7286 
Reset empty array

I'm also experiencing this, yet not being able to store empty arrays seems intentional.
xfconf-query Doesn't allow one to store empty arrays. Removing all the plugins from a panel
causes the corresponding key to vanish entirely, i.e. to be reset. And there is an assert for it,
which should be clear indication of intent.

It's just that xfconf_g_property_object_notify in xfconf-binding.c doesn't heed this yet. It will happily deliver an array with no members.
Comment 2 Ali Abdallah editbugs 2018-06-07 21:51:52 CEST
I'm closing this bug, since Victor's patch has been already applied and solves the problem. Thanks you both.

Bug #13791

Reported by:
Viktor Odintsev
Reported on: 2017-08-17
Last modified on: 2018-06-07

People

Assignee:
Ali Abdallah
CC List:
3 users

Version

Version:
4.13.0

Attachments

Allow to store empty arrays (2.21 KB, patch)
2017-08-17 02:46 CEST , Viktor Odintsev
no flags
Reset empty array (1.26 KB, patch)
2017-08-19 01:24 CEST , Stefan Berzl
no flags

Additional information