Crash when calling static getExistingDirectory in release mode of VC 2005
-
My application works fine in debug mode. It is only in release mode when the routine below should be called through a trigger of a pushbutton.
@
void RawBinOutputGui::on_pbOutDir_clicked(void)
{
QString od = Settings->value ( "Output/OutputFolder", "c:/Data" ).toString();
emit sigReportErr ( "Check sigReport Error " );
QString dir = QFileDialog::getExistingDirectory ( 0, tr("Open Output Directory"), od );
if ( dir.length() ) // in case of pressing <cancel> the dialog will return an empty string.
{
ui.leOutDir->setText ( dir );
Settings->setValue ( "Output/OutputFolder", dir );
}
}
@
This slot routine is called when the push button is pressed in a modal dialog window. The signal sigReportErr sends a signal for displaying the test in some text view window. It has been introduced for tracking the problem. When using getOpenFileName instead of getExistingDirectory there will be no crash. When using getExistingDirectory the emitted signal information is not displayed.This happens on Windows 7 64 bit and msvc 2005 and pre-compiled version 4.7.2 in release mode.
In case I do not want to change the folder, the application runs fine loading streaming information from internet.
I have also compiled the application on QT SDK (Qt creator with MinGW; Qt 4.8.1). Warnings removed and paid attention to all strange things. The release compilation with MinGW does not show the problem. No crash and the application works fine even despite it is on my old laptop with Windows XP and 32 bit.
I have started already the checking of the dialog in a smaller test program. Unfortunately, I cannot reproduce the problem.
What throws me of track a bit is that the sigReportErr message is not displayed at all when the getExistingDirectory is used. In my opinion it should be displayed since it is a simple default connect and both objects are in the same thread.
Any ideas what the problem could be?
-
What is Settings? Where does it come from? I can foresee some static QSettings*. When is it initialized?
-
Yes, Settings is a pointer to QSettings and it is initialized properly.
It does work with
@
QString dir = od; // QFileDialog::getExistingDirectory ( 0, tr("Open Output Directory"), od );
@
also when using getOpenFileName. -
There are some major differences between debug and release builds. In debug, all pointer types are initialized to 0 I believe with MSVC. If you base your initialization on some @Settings = 0@, this might fail in debug, unless you defined Settings like so: @QSettings* Settings = 0;@.
-
Thanks for reply.
That is checked. Settings is assigned and the first statement (line 3 in first post) retrieves the correct name. As soon as the getExistingDirectory is not called it does work also under release.