[Development] Question about QCoreApplicationData::*_libpaths

Marc Mutz marc.mutz at kdab.com
Fri Jan 22 11:00:28 CET 2016

On Friday 22 January 2016 09:43:17 Иван Комиссаров wrote:
> Why? In case of QMap, we have no need to use operator= to change the map.
> We simply detach and insert new data in it.
> Of course, in case of multiple changes, the map can reach some "invalid
> state" before changes are finished (i.e. in case we need transacted
> changes, we have to use mutex anyway). But it is not neccessary in some
> cases.

   class IWantToBeThreadSafe {
       int m_i;
       void setI(int i) { m_i = i; }
       int i() const { m_i; }

Make this class thead-safe (without QAtomicInt :).

Then replace 'int' with QMap.

Then you have your answer.

Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts

More information about the Development mailing list