Hi,
Sorry for the late reply. The problem was fixed when I turned the compiler optimization off in release mode. However, I still don't know where the issue is and would rather find it and fix it itself isntead of turning optimization off. I ran this code (slightly modified of yours, added the trimmed() function):
int main(int argc, char *argv[])
{
MyWindow *mw= 0;
qDebug() << s;
if(a.argc() > 1)
{
qDebug() <<"before check";
QString correctStr
= MyHelper
::getProgramStr();
qDebug() <<"str: " << correctStr;
qDebug() << a.arguments();
qDebug() << a.arguments();
qDebug() << a.arguments().at(1);
qDebug() << a.arguments().at(1).trimmed();
}
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MyWindow *mw= 0;
QString s = QString("myHardCodedString").toLower().trimmed();
qDebug() << s;
if(a.argc() > 1)
{
qDebug() <<"before check";
QString correctStr = MyHelper::getProgramStr();
qDebug() <<"str: " << correctStr;
qDebug() << a.arguments();
qDebug() << a.arguments();
qDebug() << a.arguments().at(1);
qDebug() << a.arguments().at(1).trimmed();
}
}
To copy to clipboard, switch view to plain text mode
And here's the output (there is no error when I remove the trimmed() function):
"myhardcodedstring"
before check
str: "5F7141C1DA10FA56A55810589CCD20F94E5B565B"
("C:\Users\andreyu\Documents\Visual Studio 2010\Projects\MyApp\Win32\Release\MyApp.exe", "020076EA5F473EC798FF4B6407DBE337B33084B1", "C:\Users\andreyu\Desktop\options.xml")
("C:\Users\andreyu\Documents\Visual Studio 2010\Projects\MyApp\Win32\Release\MyApp.exe", "020076EA5F473EC798FF4B6407DBE337B33084B1", "C:\Users\andreyu\Desktop\options.xml")
"020076EA5F473EC798FF4B6407DBE337B33084B1"
First-chance exception at 0x00000029 in MyApp.exe: 0xC0000005: Access violation.
Unhandled exception at 0x770915de in MyApp.exe: 0xC0000005: Access violation.
"myhardcodedstring"
before check
str: "5F7141C1DA10FA56A55810589CCD20F94E5B565B"
("C:\Users\andreyu\Documents\Visual Studio 2010\Projects\MyApp\Win32\Release\MyApp.exe", "020076EA5F473EC798FF4B6407DBE337B33084B1", "C:\Users\andreyu\Desktop\options.xml")
("C:\Users\andreyu\Documents\Visual Studio 2010\Projects\MyApp\Win32\Release\MyApp.exe", "020076EA5F473EC798FF4B6407DBE337B33084B1", "C:\Users\andreyu\Desktop\options.xml")
"020076EA5F473EC798FF4B6407DBE337B33084B1"
First-chance exception at 0x00000029 in MyApp.exe: 0xC0000005: Access violation.
Unhandled exception at 0x770915de in MyApp.exe: 0xC0000005: Access violation.
To copy to clipboard, switch view to plain text mode
This happens when I turn optimization on, when it's off it all works fine.
Here's the command line options for compiler:
/I".\GeneratedFiles" /I"." /I"C:\Qt\4.8.3\include" /I".\GeneratedFiles\Release" /I"C:\Qt\4.8.3\include\QtCore" /I"C:\Qt\4.8.3\include\QtGui" /I"C:\Qt\4.8.3\include\QtXml" /I"C:\Qt\kdsoap\include" /I"C:\Qt\4.8.3\include\QtXmlPatterns" /nologo /W1 /WX- /Ox /Oy- /D "UNICODE" /D "WIN32" /D "QT_LARGEFILE_SUPPORT" /D "QT_DLL" /D "QT_NO_DEBUG" /D "NDEBUG" /D "QT_CORE_LIB" /D "QT_GUI_LIB" /D "QT_XML_LIB" /D "QT_XMLPATTERNS_LIB" /Gm- /EHsc /MD /GS /fp:precise /Zc:wchar_t- /Zc:forScope /Fp"Release\MyApp.pch" /Fa"Release\" /Fo"Release\" /Fd"Release\vc100.pdb" /Gd /analyze- /errorReport:queue
/I".\GeneratedFiles" /I"." /I"C:\Qt\4.8.3\include" /I".\GeneratedFiles\Release" /I"C:\Qt\4.8.3\include\QtCore" /I"C:\Qt\4.8.3\include\QtGui" /I"C:\Qt\4.8.3\include\QtXml" /I"C:\Qt\kdsoap\include" /I"C:\Qt\4.8.3\include\QtXmlPatterns" /nologo /W1 /WX- /Ox /Oy- /D "UNICODE" /D "WIN32" /D "QT_LARGEFILE_SUPPORT" /D "QT_DLL" /D "QT_NO_DEBUG" /D "NDEBUG" /D "QT_CORE_LIB" /D "QT_GUI_LIB" /D "QT_XML_LIB" /D "QT_XMLPATTERNS_LIB" /Gm- /EHsc /MD /GS /fp:precise /Zc:wchar_t- /Zc:forScope /Fp"Release\MyApp.pch" /Fa"Release\" /Fo"Release\" /Fd"Release\vc100.pdb" /Gd /analyze- /errorReport:queue
To copy to clipboard, switch view to plain text mode
and linker:
/OUT:"C:\Users\andreyu\Documents\Visual Studio 2010\Projects\MyApp\Win32\Release\\MyApp.exe" /NOLOGO /LIBPATH:"C:\Qt\kdsoap\lib" /LIBPATH:"C:\Qt\4.8.3\lib" "qtmain.lib" "QtCore4.lib" "QtGui4.lib" "QtXml4.lib" "kdsoap1.lib" "QtXmlPatterns4.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /MANIFEST /ManifestFile:"Release\MyApp.exe.intermediate.manifest" /ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /PDB:"C:\Users\andreyu\Documents\Visual Studio 2010\Projects\MyApp\Win32\Release\MyApp.pdb" /SUBSYSTEM:WINDOWS /PGD:"C:\Users\andreyu\Documents\Visual Studio 2010\Projects\MyApp\Win32\Release\MyApp.pgd" /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:QUEUE
/OUT:"C:\Users\andreyu\Documents\Visual Studio 2010\Projects\MyApp\Win32\Release\\MyApp.exe" /NOLOGO /LIBPATH:"C:\Qt\kdsoap\lib" /LIBPATH:"C:\Qt\4.8.3\lib" "qtmain.lib" "QtCore4.lib" "QtGui4.lib" "QtXml4.lib" "kdsoap1.lib" "QtXmlPatterns4.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /MANIFEST /ManifestFile:"Release\MyApp.exe.intermediate.manifest" /ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /PDB:"C:\Users\andreyu\Documents\Visual Studio 2010\Projects\MyApp\Win32\Release\MyApp.pdb" /SUBSYSTEM:WINDOWS /PGD:"C:\Users\andreyu\Documents\Visual Studio 2010\Projects\MyApp\Win32\Release\MyApp.pgd" /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:QUEUE
To copy to clipboard, switch view to plain text mode
And yes, I have Qt 4.8.3 and Qt 4.8.2_x64 installed.
Bookmarks