[Qt-interest] Segfault when appending to QList

Gordon Schumacher whiplash at pobox.com
Mon Mar 22 02:49:11 CET 2010


On 3/21/2010 7:33 PM, Vedran Fura? <vedran.furac at gmail.com> wrote:
> Hi,
>
> I'm probably missing something obvious, anyways here's the (simplified)
> code:
>
> QList<QPair <int, int> >* foo;
>
> // Passing it to Bar's constructor:
>
> Bar(foo); // Bar inherits QThread.
>
> Bar::Bar(QList<QPair <int, int> >* foo)
>     : foo(foo) // Foo* foo; in private: in .h
>
> {   QPair<int, int> bla;
>     foo->append(bla);  }
>   

Two thoughts:
1) Are you sure that foo points to a valid memory location?
2) Could another thread be doing something to foo at the same time?



More information about the Qt-interest-old mailing list