OSDN Git Service

Updated Valdec decoder binary to v1.4.0a (2013-03-17).
[lamexp/LameXP.git] / src / Thread_Process.cpp
index ff36da9..8578be0 100644 (file)
@@ -1,6 +1,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 // LameXP - Audio Encoder Front-End
-// Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
+// Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de>
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -113,8 +113,7 @@ void ProcessThread::run()
                fflush(stdout);
                fflush(stderr);
                fprintf(stderr, "\nGURU MEDITATION !!!\n");
-               FatalAppExit(0, L"Unhandeled exception error, application will exit!");
-               TerminateProcess(GetCurrentProcess(), -1);
+               lamexp_fatal_exit(L"Unhandeled exception error, application will exit!");
        }
 }
 
@@ -183,6 +182,7 @@ void ProcessThread::processFile()
                }
                else
                {
+                       if(QFileInfo(outFileName).exists() && (QFileInfo(outFileName).size() < 512)) QFile::remove(outFileName);
                        handleMessage(QString("%1\n%2\n\n%3\t%4\n%5\t%6").arg(tr("The format of this file is NOT supported:"), m_audioFile.filePath(), tr("Container Format:"), m_audioFile.formatContainerInfo(), tr("Audio Format:"), m_audioFile.formatAudioCompressInfo()));
                        emit processStateChanged(m_jobId, tr("Unsupported!"), ProgressModel::JobFailed);
                        emit processStateFinished(m_jobId, outFileName, 0);
@@ -252,8 +252,18 @@ void ProcessThread::processFile()
                bSuccess = m_encoder->encode(sourceFile, m_audioFile, outFileName, &m_aborted);
        }
 
+       //Clean-up
+       if((!bSuccess) || m_aborted)
+       {
+               QFileInfo fileInfo(outFileName);
+               if(fileInfo.exists() && (fileInfo.size() < 512))
+               {
+                       QFile::remove(outFileName);
+               }
+       }
+
        //Make sure output file exists
-       if(bSuccess && !m_aborted)
+       if(bSuccess && (!m_aborted))
        {
                QFileInfo fileInfo(outFileName);
                bSuccess = fileInfo.exists() && fileInfo.isFile() && (fileInfo.size() > 0);