mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
Fix possible memory leak when invoking KLoadMetaDataThread::cancelAndDelete().
svn path=/trunk/KDE/kdebase/apps/; revision=1097154
This commit is contained in:
parent
77d9413d07
commit
072dacbb55
2 changed files with 12 additions and 5 deletions
|
@ -55,11 +55,16 @@ void KLoadMetaDataThread::load(const KUrl::List& urls)
|
|||
|
||||
void KLoadMetaDataThread::cancelAndDelete()
|
||||
{
|
||||
if (isFinished()) {
|
||||
Q_ASSERT(!isRunning());
|
||||
deleteLater();
|
||||
} else {
|
||||
connect(this, SIGNAL(finished()), this, SLOT(slotFinished()));
|
||||
m_canceled = true;
|
||||
// Setting m_canceled to true will cancel KLoadMetaDataThread::run()
|
||||
// as soon as possible. Afterwards the thread will delete itself
|
||||
// asynchronously inside slotFinished().
|
||||
}
|
||||
}
|
||||
|
||||
void KLoadMetaDataThread::run()
|
||||
|
|
|
@ -436,6 +436,8 @@ void KMetaDataWidget::Private::slotLoadingFinished()
|
|||
|
||||
m_files = m_loadMetaDataThread->files();
|
||||
|
||||
Q_ASSERT(!m_loadMetaDataThread->isRunning());
|
||||
Q_ASSERT(m_loadMetaDataThread->isFinished());
|
||||
m_loadMetaDataThread->deleteLater();
|
||||
m_loadMetaDataThread = 0;
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue