Fix memory corruption in ScanFolder plugin

Authored by valeriymalov on Sep 5 2018, 5:43 PM.

Description

Fix memory corruption in ScanFolder plugin

Summary:
Reasoning behind this patch is kinda dubious because I don't fully understand what happens, but it shouldn't make the matters worse either

Seems like deletion of KDirWatch objects from scan_folder in ~ScanThread(), after said QThread has been stopped, causes memory corruption.

Preemptively deleting scan_folder contents before we stop the thread resolves this.

also mark booleans shared across main thread and KDirWatch callbacks as atomic

Test Plan:
Without this patch unloading ScanFolder plugin sometimes crashes ktorrent, including unloading on exit
Doesn't happen anymore with this patch

Reviewers: stikonas

Reviewed By: stikonas

Differential Revision: https://phabricator.kde.org/D15265

Details

Committed
valeriymalovSep 5 2018, 5:45 PM
Reviewer
stikonas
Differential Revision
D15265: Fix memory corruption in ScanFolder plugin
Parents
R473:c52b7372c4cf: GIT_SILENT made messages (after extraction)
Branches
Unknown
Tags
Unknown