Fix KOrg category color customization crash
ClosedPublic

Authored by dkurz on Oct 8 2018, 8:07 PM.

Details

Summary

Use default value for NULL columns.

Without this patch, possibly different default values are used for
entity construction (default from akonadidb.xml) and when reading a row
from the database (default-constructed), resulting in inconsistencies.
For example, when modifying a Tag, the resulting Tag modify notification
indicates that the new parentId of the modified Tag is 0
(default-constructed qint64), whereas Tags without parents are
initialized with parentId -1. This patch fixes these inconsistencies by
considering the "default" value from akonadidb.xml for row-to-entity
conversion, too.

Set default Tag::parentId to -1.

A parentless Tag is initialized with parentId -1, so we should also
report that when reading a Tag from the database where the parentId
field is NULL.

BUG: 398459
FIXED-IN: 5.9.3

Test Plan

KOrganizer stops crashing on category color customization
with this patch. More detailed test plan suggestions welcome.

Diff Detail

Repository
R165 Akonadi
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
dkurz created this revision.Oct 8 2018, 8:07 PM
Restricted Application added a project: KDE PIM. · View Herald TranscriptOct 8 2018, 8:07 PM
Restricted Application added a subscriber: kde-pim. · View Herald Transcript
dkurz requested review of this revision.Oct 8 2018, 8:07 PM
dvratil requested changes to this revision.Oct 11 2018, 12:49 PM
dvratil added a subscriber: dvratil.
dvratil added inline comments.
src/server/storage/akonadidb.xml
70

Increase the schema version here, please.

This revision now requires changes to proceed.Oct 11 2018, 12:49 PM
dkurz updated this revision to Diff 43421.Oct 11 2018, 9:15 PM
  • Increase Akonadi DB scheme version
dkurz marked an inline comment as done.Oct 11 2018, 9:16 PM
dvratil accepted this revision.Oct 11 2018, 9:22 PM

Thanks!

This revision is now accepted and ready to land.Oct 11 2018, 9:22 PM
This revision was automatically updated to reflect the committed changes.

I tried to merge this to master but there the Akonadi DB scheme version is already higher (37), should it be bumped also there?