Commit dacb99a6 authored by Leslie Zhai's avatar Leslie Zhai

Fix crashes when close an audio cd project

BUG: 381863
parent 8d9812bf
......@@ -100,7 +100,8 @@ public:
monoBuffer(0),
decodingBufferPos(0),
decodingBufferFill(0),
valid(true) {
valid(true),
metaDataCollection(NULL) {
}
// the current position of the decoder
......@@ -118,7 +119,7 @@ public:
K3b::Msf decodingStartPos;
KFileMetaData::ExtractorCollection metaDataCollection;
KFileMetaData::ExtractorCollection *metaDataCollection;
QMimeDatabase mimeDatabase;
QMimeType mimeType;
......@@ -543,6 +544,10 @@ bool K3b::AudioDecoder::seek( const K3b::Msf& pos )
void K3b::AudioDecoder::cleanup()
{
if (d->metaDataCollection) {
delete d->metaDataCollection;
d->metaDataCollection = NULL;
}
}
......@@ -555,7 +560,9 @@ QString K3b::AudioDecoder::metaInfo( MetaDataField f )
if( !d->mimeType.isValid() )
{
d->mimeType = d->mimeDatabase.mimeTypeForFile( m_fileName );
for( KFileMetaData::Extractor* plugin : d->metaDataCollection.fetchExtractors( d->mimeType.name() ) )
if (!d->metaDataCollection)
d->metaDataCollection = new KFileMetaData::ExtractorCollection;
for( KFileMetaData::Extractor* plugin : d->metaDataCollection->fetchExtractors( d->mimeType.name() ) )
{
ExtractionResult extractionResult(m_fileName, d->mimeType.name(), d->metaInfoMap);
plugin->extract(&extractionResult);
......
......@@ -98,7 +98,7 @@ K3b::AudioTrack::~AudioTrack()
// delete all sources
while( d->firstSource )
delete d->firstSource;
delete d->firstSource->take();
qDebug() << "finished";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment