[Qt-interest] QStringList copy constructor doing something funny?
Jaco Naude
naude.jaco at gmail.com
Fri Sep 16 13:05:06 CEST 2011
Hi
I've run into a weird problem today.
The following piece of code crashes:
QStringList arguments;
// Some population of arguments.
if (arguments.count() == 3) {
if (arguments.at(1) == "-p") {
QFileInfo fi(arguments.at(2)); // Crash here
// Do some stuff with fi.
}
}
But the following does not crash:
if (arguments.count() == 3) {
if (arguments.at(1) == "-p") {
QString file_name = arguments.at(2); // Does not crash here
QFileInfo fi(file_name );
// Do some stuff with fi.
}
}
Honestly, I don't get it.
Any experts out there understand it?
Thanks,
Jaco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110916/aea1e16e/attachment.html
More information about the Qt-interest-old
mailing list