mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-05-18 03:29:25 -05:00
CSV Import: use file before it is removed by destructor
The reading of a QTemporaryFile must be done before the object it's destroyed,
otherwise the file is removed.
This was broken since 09aaaccace
Reported in issue #2749.
This commit is contained in:
+5
-1
@@ -1390,6 +1390,7 @@ void MainWindow::importTableFromCSV()
|
||||
if (QFile::exists(file))
|
||||
validFiles.push_back(file);
|
||||
}
|
||||
importCSVfiles(validFiles);
|
||||
|
||||
} else if(sender() == ui->actionFileImportCsvClipboard) {
|
||||
// Save clipboard content to temporary file
|
||||
@@ -1400,9 +1401,12 @@ void MainWindow::importTableFromCSV()
|
||||
temp.write(clipboard->text().toUtf8());
|
||||
temp.close();
|
||||
validFiles.push_back(temp.fileName());
|
||||
|
||||
// Note that the temporary file will be removed when the object is
|
||||
// destroyed, so the reading must be done in the same scope.
|
||||
importCSVfiles(validFiles);
|
||||
}
|
||||
|
||||
importCSVfiles(validFiles);
|
||||
}
|
||||
|
||||
void MainWindow::exportTableToCSV()
|
||||
|
||||
Reference in New Issue
Block a user