Skip to content

Commit

Permalink
MainWindow::sslErrors(): check that the network reply is alive
Browse files Browse the repository at this point in the history
Fixes #688.
  • Loading branch information
KitsuneRal committed Jul 22, 2023
1 parent 2a9aee2 commit b655369
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions client/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1370,7 +1370,8 @@ void MainWindow::networkError(Connection* c)
});
}

void MainWindow::sslErrors(QNetworkReply* reply, const QList<QSslError>& errors)
void MainWindow::sslErrors(const QPointer<QNetworkReply>& reply,
const QList<QSslError>& errors)
{
for (const auto& error: errors)
{
Expand Down Expand Up @@ -1398,7 +1399,10 @@ void MainWindow::sslErrors(QNetworkReply* reply, const QList<QSslError>& errors)
return;
Quotient::NetworkAccessManager::addIgnoredSslError(error);
}
reply->ignoreSslErrors(errors);
// If a message box above is left open for too long, the reply may timeout
// and self-delete (#688) - double-check that it's still alive
if (reply)
reply->ignoreSslErrors(errors);
}

void MainWindow::proxyAuthenticationRequired(const QNetworkProxy&,
Expand Down
3 changes: 2 additions & 1 deletion client/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ class MainWindow: public QMainWindow, public Quotient::UriResolverBase {

void reloginNeeded(Connection* c, const QString& message = {});
void networkError(Connection* c);
void sslErrors(QNetworkReply* reply, const QList<QSslError>& errors);
void sslErrors(const QPointer<QNetworkReply>& reply,
const QList<QSslError>& errors);
void proxyAuthenticationRequired(const QNetworkProxy& /* unused */,
QAuthenticator* auth);

Expand Down

0 comments on commit b655369

Please sign in to comment.