[Interest] QMap crash when using QtConcurrent::blockingMapped()

Björn Piltz bjornpiltz at gmail.com
Fri Oct 27 11:15:56 CEST 2017


>
>  I'm wondering if there isn't a reentrancy issue in QMap.
>
Almost. QMap works as it should if you only call const members, but as
Konstantin said operator[] on a non-const  instance is a mutating function.

I am pretty sure your problems will go away if you declare operator() as
const. Then, the const version of operator[] will be called.

This is an unfortunate side effect of Qt's implicit sharing of container
classes. There is a tiny note here about a similar problem:
http://doc.qt.io/qt-5/containers.html#implicit-sharing-iterator-problem
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20171027/9b032d40/attachment.html>


More information about the Interest mailing list