[Desktop Scripting ConfigGroup] Add more nullptr checks
ClosedPublic

Authored by broulik on Aug 3 2018, 8:47 AM.

Details

Summary

They were missing in a couple of places leading to crashes.

Test Plan

Ran the following script

print(new ConfigFile().groupList);

Used to crash, now it no longer does

Despite the qjsengine port, this file didn't change in 5.12, so should be easily backportable

Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.Aug 3 2018, 8:47 AM
Restricted Application added a project: Plasma. · View Herald TranscriptAug 3 2018, 8:47 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik requested review of this revision.Aug 3 2018, 8:47 AM
broulik edited the test plan for this revision. (Show Details)
anthonyfieroni added inline comments.
shell/scripting/configgroup.cpp
67

Here as well should be sync(), if it destroys object before timer is elapsed e.g. before 1.5 sec it will crash.

broulik updated this revision to Diff 39004.Aug 3 2018, 10:08 AM
  • Check in destructor as well

KConfigGroup is internally shared.

Why have it on the heap in the first place?

I didn't write that code, I noticed a crash that was trivially fixed and did just that

This revision was not accepted when it landed; it landed in state Needs Review.Aug 6 2018, 9:44 AM
This revision was automatically updated to reflect the committed changes.