D20722: ViewSpace: Don't ASSERT, just check for valid doc to remove from tab

Christoph Cullmann noreply at phabricator.kde.org
Mon Apr 22 17:29:12 BST 2019


cullmann added a comment.


  I would propose this fix:
  
  diff --git a/kate/kateviewspace.cpp b/kate/kateviewspace.cpp
  index 2081ff478..94d9e11a2 100644
  
  - a/kate/kateviewspace.cpp
  
  +++ b/kate/kateviewspace.cpp
  @@ -707,16 +707,12 @@ void KateViewSpace::restoreConfig(KateViewManager *viewMan, const KConfigBase *c
  
    // restore Document lru list so that all tabs from the last session reappear
    const QStringList lruList = group.readEntry("Documents", QStringList());
    for (int i = 0; i < lruList.size(); ++i) {
  
  +        // ignore non-existing documents and documents we already added to the LRU list
  +        // no wild m_lruDocList modifications to keep list + tabs in sync even for restore
  
    auto doc = KateApp::self()->documentManager()->findDocument(QUrl(lruList[i]));
  
  - if (doc) {
  - const int index = m_lruDocList.indexOf(doc);
  - if (index < 0) {
  - registerDocument(doc);
  - Q_ASSERT(m_lruDocList.contains(doc));
  - } else {
  - m_lruDocList.removeAt(index);
  - m_lruDocList.append(doc);
  - }
  
  +        if (doc && !m_lruDocList.contains(doc)) {
  +            registerDocument(doc);
  +            Q_ASSERT(m_lruDocList.contains(doc));
  
        }
    }

REPOSITORY
  R40 Kate

REVISION DETAIL
  https://phabricator.kde.org/D20722

To: loh.tar, #kate, dhaumann
Cc: cullmann, kwrite-devel, #kate, domson, michaelh, ngraham, demsking, sars, dhaumann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kwrite-devel/attachments/20190422/4260a0e0/attachment.html>


More information about the KWrite-Devel mailing list