Help needed

Hamish Rodda rodda at
Thu Nov 8 21:44:13 UTC 2007

On Fri, 9 Nov 2007 12:58:01 am Kris Wong wrote:
> > Hi,
> >
> > The reason for the following valgrind-detected issue eludes
> > me. It seems that
> > the expression visitor uses a URL which has also been used by the
> > ClassBrowser, but I don't see how/why it's been freed... any ideas?
> Problem 1: QUrlPrivate::validate claims to be const, but it's not (seems to
> be common in Qt code).  It modifies the member "encodedOriginal" by setting
> it equal to another QByteArray (see implementation of
> QByteArray::operator=(const QByteArray&) - this is were the free is
> happening).
> Problem 2: QUrlPrivate seems to be working with the internal data of
> "encodedOriginal".  If this data changes on one thread while another thread
> is working with the data - boom.
> The call to "free" is not the problem.  Is this valgrind output supposed to
> be some sort of stack trace, or is it another type of output?

Yes, it's a stack trace of an invalid read, and where the data was free'd.

It seems that the problem is QUrl is only reentrant, not thread-safe.  So, 
even though we have a lock, it doesn't prevent multiple reads, and the const 
function fiddles with the object -> boom, as you said.

So, we need to guard our access to QUrls - bother.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <>

More information about the KDevelop-devel mailing list