[Interest] ASSERT: "isDetached()" with multithreaded QVectors

Thiago Macieira thiago.macieira at intel.com
Fri Apr 27 00:56:02 CEST 2018

On Thursday, 26 April 2018 14:09:27 PDT James Ross-Smith wrote:
> From an initial discussion on the Qt forum, it would appear that mutliple
> threads are trying to modify a QVector at the same time, with one thread
> trying to modify a QVector which is already detached. Is that a correct
> interpretation?

Treat a QVector and QString like you would treat an int: only one thread can 
write to it at a time, though multiple threads can read from it at the same 
time (provided none are writing).

If you have multiple threads writing, add a mutex or a QReadWriteLock around 

> Is there a way for me to determine which QVector or line of code is causing
> the assertion?

Sure, the core dump you got when this crash happened points to one of the 
faulty threads. That thread is writing to the vector.

The problem is finding out the other thread.

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

More information about the Interest mailing list