Use existing KSharedConfig in RuleBook::save
ClosedPublic

Authored by graesslin on May 7 2018, 7:46 PM.

Details

Summary

Recently a KSharedConfig was introduced in RuleBook. It makes sense to
also use it in save and not just in load.

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
graesslin created this revision.May 7 2018, 7:46 PM
Restricted Application added a project: KWin. · View Herald TranscriptMay 7 2018, 7:46 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
graesslin requested review of this revision.May 7 2018, 7:46 PM
romangg added a subscriber: romangg.May 9 2018, 2:39 PM
romangg added inline comments.
rules.cpp
1084

Shouldn't it call openConfig in this case in order to set m_config and not just return? Also note that m_config is not initialized as a nullptr in the header file or in the constructor. Might be a problem with the check on !m_config (but should be then in the load function as well).

abetts added a subscriber: abetts.May 9 2018, 2:40 PM
abetts removed a subscriber: abetts.
graesslin added inline comments.May 9 2018, 3:24 PM
rules.cpp
1084

Save cannot be called without calling load before. Thus I decided to not add the load code as it would be dead code.

M_config is a smart pointer, thus does not need to be explicitly initialized with null.

romangg accepted this revision as: KWin, romangg.May 9 2018, 3:44 PM
romangg added inline comments.
rules.cpp
1084

Assert then?

This revision is now accepted and ready to land.May 9 2018, 3:44 PM
graesslin added inline comments.May 9 2018, 6:48 PM
rules.cpp
1084

I don't like asserts

romangg accepted this revision.May 11 2018, 12:08 AM
romangg added inline comments.
rules.cpp
1084

Maybe then a warning message. Anyways, this is a non-blocking issue for me.

graesslin marked an inline comment as done.May 20 2018, 1:45 PM
This revision was automatically updated to reflect the committed changes.