Skip to content

FileFetchJob: fix static initialization order problem

Elvis Angelaccio requested to merge work/bug-480063-for-backport into release/24.08

BasicFields/AccessFields/SharingFields are declared as static members, but in their definitions they require other static members.

This is a classic static initialization order problem. In particular it may happen that when BasicFields is defined, the Id/Title/.../Permissions members have not been defined yet: BasicFields then becomes a QStringList containing 8 empty QStrings.

This is likely what causes bug #480063 where the following broken query string is sent to google (by a FileFetchJob triggered by kio-gdrive):

fields=etag,kind,nextLink,nextPageToken,selfLink,items(,,,,,,,,labels,exportLinks,lastViewedByMeDate,alternateLink,kind)

This commit fixes the problem by duplicating the string literals in the definitions of BasicFields/AccessFields/SharingFields.

This commit is only meant for the relase/24.08 branch, so that we don't need to do breaking changes in the API.

On master we should do the right thing, which is to break the API and change BasicFields/AccessFields/SharingFields from static class members to static class methods.

BUG: 480063 FIXED-IN: 24.08.2

Merge request reports