a small optimization, a micro optimization and a fix

I tried to investigate #2003 (note, I can not reproduce it on Linux 64). So I've profiled qbittorrent during downloading several files at 7-10 MB/s. I haven't found anything interesting. I made a few changes based on results of profiling. They are beneficial, but I don't think they make any difference. Also I fixed a race condition in QAlertDispatcher.

Should I send set of small changes as one pull request or create a pull request for each commit?