[Qt-interest] Segmentation fault while converting from QString to char*

Alexandre Beraud aberaud at infflux.com
Mon Apr 19 10:30:37 CEST 2010


This is not the reason for the crash, since he stores the QByteArray 
which stays alive at least until the strcpy finishes its job. However, 
that is a mistake that one could easily make.
Regards,

Alex


J-P Nurmi a écrit :
> http://qt.nokia.com/developer/faqs/faq.2007-01-30.9032238253
>
> "Note that it is necessary to store the bytearray before you call
> data() on it, a call like the following [...] will make the
> application crash as the QByteArray has not been stored and hence no
> longer exist"
>
> --
> J-P Nurmi
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>   


-- 
Alexandre BERAUD
Ingénieur Développement

Infflux - Informatique & Flux
Tel: 01 49 57 92 00 - Fax : 01 49 57 92 01
Mail: aberaud at infflux.com
Visitez notre site :  www.infflux.com




More information about the Qt-interest-old mailing list