1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Fix crash during download when the main window have been closed

Summary:
Falkon has a feature to automatically close the tab that was specifically
opened for the file to download, because this kind of tab has no useful
purpose to the user.

In the case where the main window would have been closed, Falkon
would crash de-referencing the now NULL pointer to the main window.

This patch adds a simple check to do nothing in this case, as there is no
tab to close anyway.

Reviewers: #falkon, drosca

Reviewed By: #falkon, drosca

Subscribers: drosca, falkon, #falkon

Tags: #falkon

Differential Revision: https://phabricator.kde.org/D14711
This commit is contained in:
Christophe CURIS 2018-10-15 18:18:38 +02:00 committed by David Rosca
parent b44134fd07
commit 907e2e4938
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8

View File

@ -142,8 +142,14 @@ void DownloadManager::closeDownloadTab(const QUrl &url) const
return tabUrl.host() == url.host(); return tabUrl.host() == url.host();
}; };
if (testWebView(mApp->getWindow()->weView(), url)) { BrowserWindow* mainWindow = mApp->getWindow();
mApp->getWindow()->weView()->closeView(); // If the main window was closed, there is no need to go further
if (mainWindow == nullptr) {
return;
}
if (testWebView(mainWindow->weView(), url)) {
mainWindow->weView()->closeView();
return; return;
} }