Commit e1161211 authored by Albert Astals Cid's avatar Albert Astals Cid

Fix infinite loop when clearing a DVD Video project

BUGS: 259164
parent 43acab8a
......@@ -37,19 +37,7 @@ bool K3b::VideoDvdDoc::newDocument()
if( K3b::DataDoc::newDocument() ) {
// K3b::DataDoc::newDocument already deleted m_videoTsDir (again: bad design!)
m_videoTsDir = new K3b::DirItem( "VIDEO_TS" );
m_videoTsDir->setRemoveable(false);
m_videoTsDir->setRenameable(false);
m_videoTsDir->setMoveable(false);
m_videoTsDir->setHideable(false);
root()->addDataItem( m_videoTsDir );
K3b::DirItem* audioTsDir = new K3b::DirItem( "AUDIO_TS" );
audioTsDir->setRemoveable(false);
audioTsDir->setRenameable(false);
audioTsDir->setMoveable(false);
audioTsDir->setHideable(false);
root()->addDataItem( audioTsDir );
addAudioVideoTsDirs();
setMultiSessionMode( NONE );
......@@ -61,6 +49,39 @@ bool K3b::VideoDvdDoc::newDocument()
return false;
}
void K3b::VideoDvdDoc::clear()
{
bool addTsDirs = false;
if (m_videoTsDir) {
// K3b::DataDoc::clear() needs the items to be removeable or clear loops forever
// so change them to removeable if they exist, so they can be deleted and add them back again later
m_videoTsDir->setRemoveable(true);
m_audioTsDir->setRemoveable(true);
addTsDirs = true;
}
K3b::DataDoc::clear();
if (addTsDirs) {
addAudioVideoTsDirs();
}
}
void K3b::VideoDvdDoc::addAudioVideoTsDirs()
{
m_videoTsDir = new K3b::DirItem( "VIDEO_TS" );
m_videoTsDir->setRemoveable(false);
m_videoTsDir->setRenameable(false);
m_videoTsDir->setMoveable(false);
m_videoTsDir->setHideable(false);
root()->addDataItem( m_videoTsDir );
m_audioTsDir = new K3b::DirItem( "AUDIO_TS" );
m_audioTsDir->setRemoveable(false);
m_audioTsDir->setRenameable(false);
m_audioTsDir->setMoveable(false);
m_audioTsDir->setHideable(false);
root()->addDataItem( m_audioTsDir );
}
K3b::BurnJob* K3b::VideoDvdDoc::newBurnJob( K3b::JobHandler* hdl, QObject* parent )
{
......
......@@ -33,6 +33,7 @@ namespace K3b {
BurnJob* newBurnJob( JobHandler* hdl, QObject* parent ) override;
bool newDocument() override;
void clear() override;
DirItem* videoTsDir() const { return m_videoTsDir; }
......@@ -40,7 +41,10 @@ namespace K3b {
bool saveDocumentData(QDomElement*) override;
private:
DirItem* m_videoTsDir;
void addAudioVideoTsDirs();
DirItem* m_videoTsDir = nullptr;
DirItem* m_audioTsDir = nullptr;
};
}
......
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