src/lib/marble/AbstractFloatItem.cpp: macOS: fix a crash after when attempting to restore settings
Needs ReviewPublic

Authored by whitegeorge on Dec 13 2016, 5:45 PM.

Details

Reviewers
None
Group Reviewers
Marble
Summary

This patch is submitted as part of a Google Code-In student task.

For some bizarre reason, when the QPointF is serialised to be placed in to the QSettings (which, on macOS and iOS, uses a plist XML document), its value is lost. When restoring the position in AbstractFloatItem::setSettings from a defective plist, a sigabrt is caused by an assertion within QList::at when the index of 1 is accessed as part of restoring the QPointF from the QStringList.

This patch ensures that the QPointF is safely cast to a QVariant, and that the QVariant is restored back to a QPointF without going through the process of casting it to a QString and then attempting to create a new QPointF from that only the string value, as long as the hash in the 'metadata' field "__" contains a field "kconfig" which is true.

Diff Detail

Repository
R34 Marble
Lint
Lint Skipped
Unit
Unit Tests Skipped
whitegeorge updated this revision to Diff 8983.Dec 13 2016, 5:45 PM
whitegeorge retitled this revision from to src/lib/marble/AbstractFloatItem.cpp: macOS: fix a crash after when attempting to restore settings.
whitegeorge updated this object.
whitegeorge edited the test plan for this revision. (Show Details)
whitegeorge added a reviewer: Marble.
whitegeorge set the repository for this revision to R34 Marble.
whitegeorge added a project: Marble.
This comment was removed by whitegeorge.
whitegeorge updated this revision to Diff 9000.Dec 14 2016, 1:40 PM
whitegeorge updated this object.
whitegeorge updated this object.Dec 14 2016, 1:43 PM
whitegeorge updated this revision to Diff 9004.Dec 14 2016, 1:51 PM