diff --git a/autotests/parttest.h b/autotests/parttest.h --- a/autotests/parttest.h +++ b/autotests/parttest.h @@ -33,6 +33,7 @@ void testOpenUrlArguments(); void testAutomaticMimeType(); + void testEmptyUrlAfterCloseUrl(); void testToolbarVisibility(); }; diff --git a/autotests/parttest.cpp b/autotests/parttest.cpp --- a/autotests/parttest.cpp +++ b/autotests/parttest.cpp @@ -170,6 +170,17 @@ delete part; } +void PartTest::testEmptyUrlAfterCloseUrl() +{ + TestPart *part = new TestPart(nullptr, nullptr); + QVERIFY(part->openUrl(QUrl::fromLocalFile(QFINDTESTDATA("parttest.cpp")))); + QVERIFY(!part->url().isEmpty()); + QVERIFY(part->closeUrl()); + QVERIFY(part->url().isEmpty()); + + delete part; +} + #include #include #include diff --git a/src/readonlypart.cpp b/src/readonlypart.cpp --- a/src/readonlypart.cpp +++ b/src/readonlypart.cpp @@ -245,6 +245,7 @@ abortLoad(); //just in case d->m_arguments = KParts::OpenUrlArguments(); + d->m_url = QUrl(); if (d->m_bTemp) { QFile::remove(d->m_file);