On Sun, Feb 21, 2010 at 16:52, Adriaan de Groot <groot at kde.org> wrote:
> A solution that was applied earlier in unlock() was the following:
>
> val &= ~1;
> mtx=(QMutex*)val;
> mtx->unlock();
I believe this is the correct solution, and that the
QMutexLocker::unlock() code is wrong. If you look further down inside
the QMutexLocker class:
inline QMutex *mutex() const
{
return reinterpret_cast<QMutex *>(val & ~quintptr(1u));
}
which shows that val must be explicitly reinterpret_cast to the
appropriate QMutex* type before it (or mtx assigned to it) can be
used. The same should happen inside mtx->unlock():
My reading of the -xalias_level=compatible tells me that val should
not alias mtx, because they are not compatible types, and mtx is not a
POD.
--Stefan
--
Stefan Teleman
KDE e.V.
stefan.teleman at gmail.com