[Qt-interest] QStringList copy constructor doing something funny?
Mandeep Sandhu
mandeepsandhu.chd at gmail.com
Fri Sep 16 13:18:38 CEST 2011
> QFileInfo fi(arguments.at(2)); // Crash here
This is because of an 'automatic variable' being used here. The return
value of the function (QList::at()) is stored in an automatic variable
(created by the complier) who's scope is this line of code alone. This
variable does not exist after the said stmt.
However, when you storing it in a separate var 'file_name', it
persists till the encapsulating if block's scope.
HTH,
-mandeep
More information about the Qt-interest-old
mailing list