Commit b3e85e47 authored by Stefano Crocco's avatar Stefano Crocco Committed by David Faure
Browse files

Shut down Konqueror even when "always have preloaded instance" option is on

parent d3b9cec9
......@@ -28,6 +28,7 @@
#include <QDir>
#include <QDirIterator>
#include <QStandardPaths>
#include <QProcess>
#include <KDBusService>
#include <QCommandLineParser>
......@@ -276,8 +277,12 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
}
}
QString programName = QApplication::applicationFilePath();
const int ret = app.exec();
bool alwaysPreload = KonqSettings::alwaysHavePreloaded();
// Delete all KonqMainWindows, so that we don't have
// any parts loaded when KLibLoader::cleanUp is called.
// (and Qt doesn't delete WA_DeleteOnClose widgets on exit anyway :()
......@@ -292,5 +297,9 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
KonqClosedWindowsManager::destroy();
if (alwaysPreload) {
QProcess::startDetached(programName, {"--preload"});
}
return ret;
}
......@@ -317,6 +317,15 @@ KonqMainWindow::~KonqMainWindow()
if (s_lstMainWindows->isEmpty()) {
delete s_lstMainWindows;
s_lstMainWindows = nullptr;
} else if (s_lstMainWindows->length() == 1 && s_lstMainWindows->first()->isPreloaded()) {
//If the only remaining window is preloaded, we want to close it. Otherwise,
//the application will remain open, even if there are no visible windows.
//This can be seen, for example, running Konqueror from a terminal with the
//"Always try to have a preloaded instance": even after closing the last
//window, Konqueror won't exit (see bug #258124). To avoid this situation,
//We close the preloaded window here, so that the application can exit,
//and launch another instance of Konqueror from konqmain.
s_lstMainWindows->first()->close();
}
}
......
Supports Markdown
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