Runtime error when cancelling QFileDialog
-
Good pm! I'm new to Qt Creator and can't seem to find a thread in any forum that is helpful for my issue. Whenever I cancel the QFileDialog::getOpenFileNames function, i get a runtime error "Invalid parameter passed to C runtime function." This happens when using both (X) button and cancel button. Error happens when the program runs the function and does not reach checking if QStringList is null/empty...Help would be greatly appreciated
-
It happens while running the code in Qt Creator. I have not tried creating an executable program so I can't say if it will happen outside Qt Creator.. but isn't that how it goes, if it happens in debug mode it will happen during exe run as well? OS is Windows 7. Qt Creator Version is 5.7.0. This is the error message
-
there's a checking of whether or not the list is empty and the program should inform the user if it was cancelled. but it doesn't even reach the checking. i tried creating a messagebox before the checking just to see if fileNames was populated. it did not reach that part of the code either. From observation, the program crashes when QFileDialog::getOpenFileNames is being cancelled. I just don't know how I'm supposed to handle it. I can't even determine what the return value is because the system crashes first.
if(fileNames.empty())// CHECKS IF NOT EMPTY OR CANCELLED
{
QMessageBox cancelled;
cancelled.setWindowTitle("Failed File Selection");
cancelled.setText("No file Selected");
cancelled.exec();
}
else -
It happens while running the code in Qt Creator. I have not tried creating an executable program so I can't say if it will happen outside Qt Creator.. but isn't that how it goes, if it happens in debug mode it will happen during exe run as well? OS is Windows 7. Qt Creator Version is 5.7.0. This is the error message
-
Hi
You should try with a clean default project.
And only call QFileDialog::getOpenFileNames(xxx)If it can crash on that line alone then your windows is not in fully working condition :)