fix some crashes, mostly related to network requests (#6187)

This commit is contained in:
pajlada
2025-05-17 14:22:56 +02:00
committed by GitHub
parent 46f3299a25
commit 6b968a199c
17 changed files with 259 additions and 81 deletions
+27 -2
View File
@@ -131,6 +131,14 @@ void NetworkData::emitSuccess(NetworkResult &&result)
return;
}
if (isAppAboutToQuit())
{
qCDebug(chatterinoHTTP)
<< "Success callback for" << url.toString()
<< "skipped because we're about to quit";
return;
}
QElapsedTimer timer;
timer.start();
cb(result);
@@ -153,12 +161,21 @@ void NetworkData::emitError(NetworkResult &&result)
runCallback(this->executeConcurrently,
[cb = std::move(this->onError), result = std::move(result),
hasCaller = this->hasCaller, caller = this->caller]() {
url = this->request.url(), hasCaller = this->hasCaller,
caller = this->caller]() {
if (hasCaller && caller.isNull())
{
return;
}
if (isAppAboutToQuit())
{
qCDebug(chatterinoHTTP)
<< "Error callback for" << url.toString()
<< "skipped because we're about to quit";
return;
}
cb(result);
});
}
@@ -172,12 +189,20 @@ void NetworkData::emitFinally()
runCallback(this->executeConcurrently,
[cb = std::move(this->finally), hasCaller = this->hasCaller,
caller = this->caller]() {
url = this->request.url(), caller = this->caller]() {
if (hasCaller && caller.isNull())
{
return;
}
if (isAppAboutToQuit())
{
qCDebug(chatterinoHTTP)
<< "Finally callback for" << url.toString()
<< "skipped because we're about to quit";
return;
}
cb();
});
}