Commit e3ece7bd authored by Christoph Roick's avatar Christoph Roick

Reuse unmodified empty document instead of closing it

- In VI-Mode, using :e filename or :tabe filename in the empty
  unmodified initial document makes Kate crash. The caller is
  deleted by closing the document.
- Reusing the already opened document avoids the problem.

Test Plan: - use :e filename in VI-Mode from a fresh kate instance

Reviewers: #kate, cullmann

Reviewed By: #kate, cullmann

Subscribers: cullmann

Tags: #kate

Differential Revision:
parent 65293473
......@@ -173,7 +173,15 @@ KTextEditor::Document *KateDocManager::openUrl(const QUrl &url, const QString &e
if (!doc) {
doc = createDoc(docInfo);
if (untitledDoc) {
// reuse the untitled document which is not needed
auto & info = m_docInfos.find(untitledDoc).value();
delete info;
info = new KateDocumentInfo(docInfo);
doc = untitledDoc;
} else {
doc = createDoc(docInfo);
if (!encoding.isEmpty()) {
......@@ -197,13 +205,6 @@ KTextEditor::Document *KateDocManager::openUrl(const QUrl &url, const QString &e
// close untitled document, as it is not wanted
if (untitledDoc) {
return doc;
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