[Qt-interest] implicitly shared container iterators

amulya rattan talk2amulya at gmail.com
Mon May 3 09:33:58 CEST 2010


Guys,

Knowing that QHash is a implicitly shared class and if i do something like:

QHash<QString, QThread*>::iterator it; // non-const iterator
        for (it = _loggers.begin(); it != _loggers.end(); ++it)
        {
            if (it.value())
                delete it.value();

            it.value() = NULL;
        }
        _loggers.clear();

i believe it will create deep copy of items in hash. In that case, after i
do delete it.value(), would there be dangling pointers of QThread(because of
deep copy)?
Can someone confirm this?

Thanks,
~Amulya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100503/155d8e58/attachment.html 


More information about the Qt-interest-old mailing list