Fixed potential crash when trying to import Cue Sheet where *all* files are missing: If none of the files exist, we shouldn't try to analyze them. The real problem, however, was a potential NULL-pointer access in the FileAnalyzer thread's destructor code. Thanks to XhmikosR for reporting!

This commit is contained in:
LoRd_MuldeR 2014-08-16 14:45:18 +02:00
parent a63baad374
commit 0a65e42012
22 changed files with 135 additions and 61 deletions

View File

@ -21,6 +21,7 @@ a:visited { color: #0000EE; }
<li>Updated mpg123 decoder to v1.20.1 (2014-06-17), compiled with GCC 4.9.0
<li>Updated Vorbis encoder to OggEnc v2.87 (2014-06-24), using libvorbis v1.3.4 and aoTuV b6.03_2014
<li>Updated Vorbis decoder to OggDec v1.10.1 (2014-06-25), using libVorbis v1.3.4
<li>Fixed potential crash in Cue Sheet importer (occurred when *all* input files were missing)
</ul><br>
<a name="4.10"></a>Changes between v4.09 and v4.10 [2014-06-23]:<br><ul>

View File

@ -434,8 +434,9 @@
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="121"/>
<location filename="../../src/Dialog_CueImport.cpp" line="222"/>
<location filename="../../src/Dialog_CueImport.cpp" line="420"/>
<location filename="../../src/Dialog_CueImport.cpp" line="424"/>
<location filename="../../src/Dialog_CueImport.cpp" line="358"/>
<location filename="../../src/Dialog_CueImport.cpp" line="431"/>
<location filename="../../src/Dialog_CueImport.cpp" line="435"/>
<source>Cue Sheet Error</source>
<translation type="unfinished"></translation>
</message>
@ -542,63 +543,70 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="383"/>
<location filename="../../src/Dialog_CueImport.cpp" line="358"/>
<source>Warning: Some of the required input files could not be found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="394"/>
<source>Analyzing file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="388"/>
<location filename="../../src/Dialog_CueImport.cpp" line="399"/>
<source>Analysis Failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="388"/>
<location filename="../../src/Dialog_CueImport.cpp" line="399"/>
<source>Warning: The format of some of the input files could not be determined!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="388"/>
<location filename="../../src/Dialog_CueImport.cpp" line="358"/>
<location filename="../../src/Dialog_CueImport.cpp" line="399"/>
<source>Continue Anyway</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="388"/>
<location filename="../../src/Dialog_CueImport.cpp" line="358"/>
<location filename="../../src/Dialog_CueImport.cpp" line="399"/>
<source>Abort</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="415"/>
<location filename="../../src/Dialog_CueImport.cpp" line="426"/>
<source>Splitting file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_CueImport.cpp" line="420"/>
<location filename="../../src/Dialog_CueImport.cpp" line="431"/>
<source>Process was aborted by the user after %n track(s)!</source>
<translation type="unfinished">
<numerusform></numerusform>
</translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="424"/>
<location filename="../../src/Dialog_CueImport.cpp" line="435"/>
<source>An unexpected error has occured while splitting the Cue Sheet!</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_CueImport.cpp" line="428"/>
<location filename="../../src/Dialog_CueImport.cpp" line="439"/>
<source>Imported %n track(s) from the Cue Sheet.</source>
<translation type="unfinished">
<numerusform></numerusform>
</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_CueImport.cpp" line="428"/>
<location filename="../../src/Dialog_CueImport.cpp" line="439"/>
<source>Skipped %n track(s).</source>
<translation type="unfinished">
<numerusform></numerusform>
</translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="429"/>
<location filename="../../src/Dialog_CueImport.cpp" line="440"/>
<source>Cue Sheet Completed</source>
<translation type="unfinished"></translation>
</message>

View File

@ -470,6 +470,10 @@
<numerusform>%n Dateien übersprungen.</numerusform>
</translation>
</message>
<message>
<source>Warning: Some of the required input files could not be found!</source>
<translation>Achtung: Einige der Eingabedateien konnten nicht gefunden werden!</translation>
</message>
</context>
<context>
<name>CueSheetImport</name>

View File

@ -4,7 +4,7 @@
<context>
<name>CueImportDialog</name>
<message numerus="yes">
<location filename="../../src/Dialog_CueImport.cpp" line="420"/>
<location filename="../../src/Dialog_CueImport.cpp" line="431"/>
<source>Process was aborted by the user after %n track(s)!</source>
<translation>
<numerusform>Process was aborted by the user after %n track!</numerusform>
@ -12,7 +12,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_CueImport.cpp" line="428"/>
<location filename="../../src/Dialog_CueImport.cpp" line="439"/>
<source>Imported %n track(s) from the Cue Sheet.</source>
<translation>
<numerusform>Imported %n track from the Cue Sheet.</numerusform>
@ -20,7 +20,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_CueImport.cpp" line="428"/>
<location filename="../../src/Dialog_CueImport.cpp" line="439"/>
<source>Skipped %n track(s).</source>
<translation>
<numerusform>Skipped %n track.</numerusform>

View File

@ -470,6 +470,10 @@
<numerusform>%n pistas omitidas.</numerusform>
</translation>
</message>
<message>
<source>Warning: Some of the required input files could not be found!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueSheetImport</name>

View File

@ -474,6 +474,10 @@
<numerusform>%n pistes ignorées.</numerusform>
</translation>
</message>
<message>
<source>Warning: Some of the required input files could not be found!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueSheetImport</name>

View File

@ -470,6 +470,10 @@
<numerusform></numerusform>
</translation>
</message>
<message>
<source>Warning: Some of the required input files could not be found!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueSheetImport</name>

View File

@ -468,6 +468,10 @@
<numerusform>%n .</numerusform>
</translation>
</message>
<message>
<source>Warning: Some of the required input files could not be found!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueSheetImport</name>

View File

@ -434,8 +434,9 @@
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="121"/>
<location filename="../../src/Dialog_CueImport.cpp" line="222"/>
<location filename="../../src/Dialog_CueImport.cpp" line="420"/>
<location filename="../../src/Dialog_CueImport.cpp" line="424"/>
<location filename="../../src/Dialog_CueImport.cpp" line="358"/>
<location filename="../../src/Dialog_CueImport.cpp" line="431"/>
<location filename="../../src/Dialog_CueImport.cpp" line="435"/>
<source>Cue Sheet Error</source>
<translation type="unfinished">Błąd pliku Cue Sheet</translation>
</message>
@ -542,37 +543,44 @@
<translation type="unfinished">Jest wysoce zalecane zwolnić miejsce na dysku zanim zaczniesz importować!</translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="383"/>
<location filename="../../src/Dialog_CueImport.cpp" line="358"/>
<source>Warning: Some of the required input files could not be found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="394"/>
<source>Analyzing file(s), please wait...</source>
<translation type="unfinished">Analizowanie pliku/ów, prosze czekać...</translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="388"/>
<location filename="../../src/Dialog_CueImport.cpp" line="399"/>
<source>Analysis Failed</source>
<translation type="unfinished">Analiza zakończona niepowodzeniem</translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="388"/>
<location filename="../../src/Dialog_CueImport.cpp" line="399"/>
<source>Warning: The format of some of the input files could not be determined!</source>
<translation type="unfinished">Ostrzeżenie: Nie można rozpoznać formatu kilku plików wejściowych!</translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="388"/>
<location filename="../../src/Dialog_CueImport.cpp" line="358"/>
<location filename="../../src/Dialog_CueImport.cpp" line="399"/>
<source>Continue Anyway</source>
<translation type="unfinished">Kontynuuj pomimo to</translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="388"/>
<location filename="../../src/Dialog_CueImport.cpp" line="358"/>
<location filename="../../src/Dialog_CueImport.cpp" line="399"/>
<source>Abort</source>
<translation type="unfinished">Przerwij</translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="415"/>
<location filename="../../src/Dialog_CueImport.cpp" line="426"/>
<source>Splitting file(s), please wait...</source>
<translation type="unfinished">Dzielenie pliku/ów, prosze czekać...</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_CueImport.cpp" line="420"/>
<location filename="../../src/Dialog_CueImport.cpp" line="431"/>
<source>Process was aborted by the user after %n track(s)!</source>
<translation type="unfinished">
<numerusform>Proces został przerwany przez użytkownika po zakończeniu %n ścieżki!</numerusform>
@ -581,12 +589,12 @@
</translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="424"/>
<location filename="../../src/Dialog_CueImport.cpp" line="435"/>
<source>An unexpected error has occured while splitting the Cue Sheet!</source>
<translation type="unfinished">Wystąpił nieoczekiwany błąd podczas podziału pliku Cue Sheet!</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_CueImport.cpp" line="428"/>
<location filename="../../src/Dialog_CueImport.cpp" line="439"/>
<source>Imported %n track(s) from the Cue Sheet.</source>
<translation type="unfinished">
<numerusform>Zaimportowano %n ścieżkę z pliku Cue Sheet.</numerusform>
@ -595,7 +603,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_CueImport.cpp" line="428"/>
<location filename="../../src/Dialog_CueImport.cpp" line="439"/>
<source>Skipped %n track(s).</source>
<translation type="unfinished">
<numerusform>Pominięto %n ścieżkę.</numerusform>
@ -604,7 +612,7 @@
</translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="429"/>
<location filename="../../src/Dialog_CueImport.cpp" line="440"/>
<source>Cue Sheet Completed</source>
<translation type="unfinished">Utworzono plik Cue Sheet</translation>
</message>

View File

@ -475,6 +475,10 @@
<numerusform>Пропущено %n трэков.</numerusform>
</translation>
</message>
<message>
<source>Warning: Some of the required input files could not be found!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueSheetImport</name>

View File

@ -435,8 +435,9 @@
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="121"/>
<location filename="../../src/Dialog_CueImport.cpp" line="222"/>
<location filename="../../src/Dialog_CueImport.cpp" line="420"/>
<location filename="../../src/Dialog_CueImport.cpp" line="424"/>
<location filename="../../src/Dialog_CueImport.cpp" line="358"/>
<location filename="../../src/Dialog_CueImport.cpp" line="431"/>
<location filename="../../src/Dialog_CueImport.cpp" line="435"/>
<source>Cue Sheet Error</source>
<translation>Cue-fel</translation>
</message>
@ -543,37 +544,44 @@
<translation>Du bör frigöra mer diskutrymme innan du fortsätter med importen!</translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="383"/>
<location filename="../../src/Dialog_CueImport.cpp" line="358"/>
<source>Warning: Some of the required input files could not be found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="394"/>
<source>Analyzing file(s), please wait...</source>
<translation>Analyserar fil(er), vänta...</translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="388"/>
<location filename="../../src/Dialog_CueImport.cpp" line="399"/>
<source>Analysis Failed</source>
<translation>Analys misslyckades</translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="388"/>
<location filename="../../src/Dialog_CueImport.cpp" line="399"/>
<source>Warning: The format of some of the input files could not be determined!</source>
<translation>Varning! Formatet vissa filer kunde inte avgöras!</translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="388"/>
<location filename="../../src/Dialog_CueImport.cpp" line="358"/>
<location filename="../../src/Dialog_CueImport.cpp" line="399"/>
<source>Continue Anyway</source>
<translation>Fortsätt ändå</translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="388"/>
<location filename="../../src/Dialog_CueImport.cpp" line="358"/>
<location filename="../../src/Dialog_CueImport.cpp" line="399"/>
<source>Abort</source>
<translation>Avbryt</translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="415"/>
<location filename="../../src/Dialog_CueImport.cpp" line="426"/>
<source>Splitting file(s), please wait...</source>
<translation>Delar fil(er), vänta...</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_CueImport.cpp" line="420"/>
<location filename="../../src/Dialog_CueImport.cpp" line="431"/>
<source>Process was aborted by the user after %n track(s)!</source>
<translation>
<numerusform>Åtgärden avbröts av användaren efter %n spår!</numerusform>
@ -581,12 +589,12 @@
</translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="424"/>
<location filename="../../src/Dialog_CueImport.cpp" line="435"/>
<source>An unexpected error has occured while splitting the Cue Sheet!</source>
<translation>Ett oväntat fel uppstod vid delningen av cue-filen!</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_CueImport.cpp" line="428"/>
<location filename="../../src/Dialog_CueImport.cpp" line="439"/>
<source>Imported %n track(s) from the Cue Sheet.</source>
<translation>
<numerusform>Importerade %n spår från cue-filen.</numerusform>
@ -594,7 +602,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_CueImport.cpp" line="428"/>
<location filename="../../src/Dialog_CueImport.cpp" line="439"/>
<source>Skipped %n track(s).</source>
<translation>
<numerusform>Hoppade över %n spår.</numerusform>
@ -602,7 +610,7 @@
</translation>
</message>
<message>
<location filename="../../src/Dialog_CueImport.cpp" line="429"/>
<location filename="../../src/Dialog_CueImport.cpp" line="440"/>
<source>Cue Sheet Completed</source>
<translation>cue-fil färdigbearbetad</translation>
</message>

View File

@ -467,6 +467,10 @@
<numerusform> %n .</numerusform>
</translation>
</message>
<message>
<source>Warning: Some of the required input files could not be found!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueSheetImport</name>

View File

@ -474,6 +474,10 @@
<numerusform>Пропущено %n доріжок.</numerusform>
</translation>
</message>
<message>
<source>Warning: Some of the required input files could not be found!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueSheetImport</name>

View File

@ -467,6 +467,10 @@
<numerusform> %n </numerusform>
</translation>
</message>
<message>
<source>Warning: Some of the required input files could not be found!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueSheetImport</name>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -35,7 +35,7 @@
#define VER_LAMEXP_MINOR_LO 1
#define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 1
#define VER_LAMEXP_BUILD 1565
#define VER_LAMEXP_BUILD 1566
#define VER_LAMEXP_CONFG 1558
///////////////////////////////////////////////////////////////////////////////

View File

@ -330,41 +330,52 @@ void CueImportDialog::analyzedFile(const AudioFileModel &file)
void CueImportDialog::importCueSheet(void)
{
QStringList files;
QList<LockedFile*> locks;
//Fetch all files that are referenced in the Cue Sheet and lock them
int nFiles = m_model->getFileCount();
for(int i = 0; i < nFiles; i++)
{
QString temp = m_model->getFileName(i);
try
{
m_locks << new LockedFile(temp);
LockedFile *temp = new LockedFile(m_model->getFileName(i));
locks << temp;
files << temp->filePath();
}
catch(const std::exception &error)
{
qWarning("Failed to lock file:\n%s\n", error.what());
continue;
}
catch(...)
{
qWarning("Failed to lock file!");
continue;
}
files << temp;
}
//Analyze all source files first
if(analyzeFiles(files))
//Check if all files could be locked
if(files.count() < m_model->getFileCount())
{
//Now split files according to Cue Sheet
splitFiles();
if(QMessageBox::warning(this, tr("Cue Sheet Error"), tr("Warning: Some of the required input files could not be found!"), tr("Continue Anyway"), tr("Abort")) == 1)
{
files.clear();
}
}
//Process all avialble input files
if(files.count() > 0)
{
//Analyze all source files first
if(analyzeFiles(files))
{
//Now split files according to Cue Sheet
splitFiles();
}
}
//Release locks
while(!m_locks.isEmpty())
while(!locks.isEmpty())
{
delete m_locks.takeFirst();
delete locks.takeFirst();
}
}

View File

@ -68,7 +68,6 @@ private:
const SettingsModel *m_settings;
QList<LockedFile*> m_locks;
QList<AudioFileModel> m_fileInfo;
QString m_cueFileName;
QString m_outputDir;

View File

@ -201,9 +201,9 @@ LockedFile::LockedFile(const QString &filePath, const bool bOwnsFile)
existingFileInfo.setCaching(false);
//Make sure the file exists, before we try to lock it
if(!(existingFileInfo.exists() && existingFileInfo.isFile()))
if((!existingFileInfo.exists()) || (!existingFileInfo.isFile()) || m_filePath.isEmpty())
{
THROW_FMT("File '%s' does not exist!", QUTF8(m_filePath));
THROW_FMT("File '%s' does not exist!", QUTF8(filePath));
}
//Now lock the file

View File

@ -76,9 +76,12 @@ FileAnalyzer::FileAnalyzer(const QStringList &inputFiles)
FileAnalyzer::~FileAnalyzer(void)
{
if(!m_pool->waitForDone(2500))
if(m_pool)
{
qWarning("There are still running tasks in the thread pool!");
if(!m_pool->waitForDone(2500))
{
qWarning("There are still running tasks in the thread pool!");
}
}
LAMEXP_DELETE(m_templateFile);