Fix race condition in core/generator.cpp
requested to merge tobiasdeiminger/okular:bugfix/race_condition_when_allocating_mutext into release/19.12
The check whether to allocate a new QMutex
was unprotected. Two threads may check and allocate concurrently, but only one pointer gets remembered, the other one will leak. In worst case the returned mutex is different for two threads, so that two threads try to synchronize by using two different mutexes.