Commit 14f33bf9 authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Fix closing a doc causes a crash sometimes

parent d5aeee56
...@@ -242,13 +242,10 @@ bool KateDocManager::closeDocuments(const QList<KTextEditor::Document *> &docume ...@@ -242,13 +242,10 @@ bool KateDocManager::closeDocuments(const QList<KTextEditor::Document *> &docume
// really delete the document and its infos // really delete the document and its infos
m_docInfos.erase(doc); m_docInfos.erase(doc);
auto it = std::find(m_docList.begin(), m_docList.end(), doc); delete m_docList.takeAt(m_docList.indexOf(doc));
if (it != m_docList.end()) {
delete *it; // document is gone, emit our signals
// document is gone, emit our signals Q_EMIT documentDeleted(doc);
Q_EMIT documentDeleted(doc);
m_docList.erase(it);
}
last++; last++;
} }
......
...@@ -190,10 +190,7 @@ void KateViewSpace::tabBarToggled() ...@@ -190,10 +190,7 @@ void KateViewSpace::tabBarToggled()
KTextEditor::View *KateViewSpace::createView(KTextEditor::Document *doc) KTextEditor::View *KateViewSpace::createView(KTextEditor::Document *doc)
{ {
// should only be called if a view does not yet exist // should only be called if a view does not yet exist
{ Q_ASSERT(m_docToView.find(doc) == m_docToView.end());
auto it = m_docToView.find(doc);
Q_ASSERT(it == m_docToView.end());
}
/** /**
* Create a fresh view * Create a fresh view
......
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