Dictionary Engine: fix synchronization issues.
ClosedPublic

Authored by dfaure on Oct 15 2017, 9:32 PM.

Details

Summary

QMutex isn't the right tool for this:

  • If tryLock succeeds, the code didn't unlock the mutex again, leading

to the runtime warning "QMutex: destroying locked mutex"

  • But if we add "else data.mutex.unlock()" then we risk that the other thread also

calls unlock(), on a now-unlocked mutex, which is undefined behaviour.

QWaitCondition is the right tool for waiting for something to happen,
allowing us to unlock the mutex correctly in all cases.

Test Plan

Alt+F2 "define test". Doesn't seem to work very reliably yet, though.

Diff Detail

Repository
R114 Plasma Addons
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
dfaure created this revision.Oct 15 2017, 9:32 PM
Restricted Application added a project: Plasma. · View Herald TranscriptOct 15 2017, 9:32 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
mart accepted this revision.Oct 17 2017, 8:57 AM
This revision is now accepted and ready to land.Oct 17 2017, 8:57 AM
This revision was automatically updated to reflect the committed changes.