Remove unnecessary unlock with QMutexLocker

Also do some code clean up