if (m_updateItemStatesThread != 0) {
disconnect(m_updateItemStatesThread, SIGNAL(finished()),
this, SLOT(applyUpdatedItemStates()));
- m_updateItemStatesThread->deleteWhenFinished();
+ if (m_updateItemStatesThread->isFinished()) {
+ delete m_updateItemStatesThread;
+ } else {
+ m_updateItemStatesThread->deleteWhenFinished();
+ }
m_updateItemStatesThread = 0;
}
+
+ m_plugin->disconnect();
+ m_plugin = 0;
}
QList<QAction*> VersionControlObserver::contextMenuActions(const KFileItemList& items) const
void VersionControlObserver::applyUpdatedItemStates()
{
+ if (m_plugin == 0) {
+ // The signal finished() has been emitted, but the thread has been marked
+ // as invalid in the meantime. Just ignore the signal in this case.
+ return;
+ }
+
if (!m_updateItemStatesThread->retrievedItems()) {
// ignore m_silentUpdate for an error message
emit errorMessage(i18nc("@info:status", "Update of version information failed."));
{
Q_ASSERT(m_plugin != 0);
if (m_updateItemStatesThread == 0) {
- m_updateItemStatesThread = new UpdateItemStatesThread(this);
+ m_updateItemStatesThread = new UpdateItemStatesThread();
connect(m_updateItemStatesThread, SIGNAL(finished()),
this, SLOT(applyUpdatedItemStates()));
}