[Qt-interest] SegFaults I cannot interpret

Scott Aron Bloom Scott.Bloom at sabgroup.com
Tue Feb 24 20:21:19 CET 2009



> -----Original Message-----
> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
> bounces at trolltech.com] On Behalf Of Andrea Franceschini
> Sent: Tuesday, February 24, 2009 10:47 AM
> To: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] SegFaults I cannot interpret
> 
> 2009/2/24 Scott Aron Bloom <Scott.Bloom at sabgroup.com>:
> 
> > I would consider createing a QStroke class, that HAS a list of
Cursor
> > postions, but has its own set/get functions AND is reentrant.
> 
> So I'd have a QList<QStroke> instead of that, right? That may be
> feasible, I'll try it.
> 
> Anyway I tried to go through valgrind and all I got is "omg, you have
> so many errors, you fool!" and the errors were given only by
> fglrx_dri.so which is not at all under my control :) I also tried
> going without the error limit but the only thing I got is "the main
> stack is less than 8M, apparently you're a good person, still here's
> your segfault".
> 
> --
> Andrea
> _______________________________________________

Can you run the app in a single threaded mode?

As to the QList< QStroke >   You may also need a QStrokes class...
without seeing some code, its hard to say..



Looking at the code you sent, I am not convinced its not a
re-entrant/concurrency issue...

Your paint call is having problems accessing the list...

One thing I have used is this technique for debugging multi-threaded
apps...

1) Name every QThread.  Depending on the type of threads, (ie 5 copies
of 1 thread all doing the same thing, or 5 different threads completely)
you will have to determine a unique naming scheme for each thread in
use.. Including the "main" thread... You can name that using
QThread::currentThread()->setObjectName( "MainThread" )

2) in every accessor to the data (the QList<QList<Doodle::Cursor>>)
print out something like qDEbug() << "List accessed by" <<
QThread::currentThread()->objectName()

Do this FOR EVERY read/write to the data... That's why encapsulating the
data into a private class makes things a bit easier...

In doing this, you may just find what your looking for.

Scott






More information about the Qt-interest-old mailing list