[Qt-interest] SegFaults I cannot interpret
Thiago Macieira
thiago.macieira at trolltech.com
Tue Feb 24 21:45:39 CET 2009
Andrea Franceschini wrote:
>Clearly these are something that go far beyond my ability of
>inspection (and patience, since I'm working on strict time constraint
>and a single step-debug session would take an entire day and even
>wouldn't give any warranty of producing the crash at all) so if
>anybody of you guys can give me some insight, I'm totally lost.
When you're out of other options, you can always resort to reducing your
code until you can no longer reproduce the problem. When you do that,
you'll see which change exactly causes the problem.
You'll also have a much smaller codebase which you can send to mailing
lists and ask for help.
Looking at your backtraces, I can only make guesses at what the problem
is. I need to see more of your code and how it happens to be of more help.
The first backtrace has this=0x0, which indicates that the QList's d-
pointer is 0. That can NEVER happen with QList, since d is initialised at
the constructor to a value different from 0 and never set to 0. That means
you're accessing an object that hasn't been constructed yet.
The second backtrace has a valid pointer address (properly aligned, in the
heap region on 32-bit Linux), but it's crashing trying to dereference the
d-pointer. Again, the d-pointer on QList is never invalid -- it does
replacements atomically, so at any given point in a QList's lifetime, the
d-pointers are valid.
That assumes that you're not accessing the same QList from multiple
threads: QList is reentrant, not thread-safe.
So, my guesses are:
1) Doodle::Painter::paint is accessing a QList object before it is
initialised or after it was deleted (dangling pointer). Note
Painter.cpp:95 is copying a list and it's the source that has a problem.
2) you've got a memory overrun somewhere and you're writing garbage to
QList::d
I don't think this is a threading issue because of the this=0x0 case:
since QList never does that, it can only be 0x0 for external reasons.
--
Thiago Macieira - thiago.macieira (AT) nokia.com
Senior Product Manager - Nokia, Qt Software
Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090224/71f69789/attachment.bin
More information about the Qt-interest-old
mailing list