mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-18 16:17:03 +00:00
GODT-2071: fix --no-window flag that was broken on Windows.
This commit is contained in:
@ -219,14 +219,14 @@ bool isBridgeRunning()
|
|||||||
QTimer timer;
|
QTimer timer;
|
||||||
timer.setSingleShot(true);
|
timer.setSingleShot(true);
|
||||||
|
|
||||||
QNetworkReply *rep = networkManager().get(QNetworkRequest(getFocusUrl()));
|
std::unique_ptr<QNetworkReply> reply(networkManager().get(QNetworkRequest(getFocusUrl())));
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
bool timedOut = false;
|
bool timedOut = false;
|
||||||
QObject::connect(&timer, &QTimer::timeout, [&]() { timedOut = true; loop.quit(); });
|
QObject::connect(&timer, &QTimer::timeout, [&]() { timedOut = true; loop.quit(); });
|
||||||
QObject::connect(rep, &QNetworkReply::finished, &loop, &QEventLoop::quit);
|
QObject::connect(reply.get(), &QNetworkReply::finished, &loop, &QEventLoop::quit);
|
||||||
timer.start(1000); // we time out after 1 second and consider no other instance is running.
|
timer.start(1000); // we time out after 1 second and consider no other instance is running.
|
||||||
loop.exec();
|
loop.exec();
|
||||||
return ((!timedOut) && (rep->error() == QNetworkReply::NetworkError::NoError));
|
return ((!timedOut) && (reply->error() == QNetworkReply::NetworkError::NoError));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -235,9 +235,9 @@ bool isBridgeRunning()
|
|||||||
//****************************************************************************************************************************************************
|
//****************************************************************************************************************************************************
|
||||||
void focusOtherInstance()
|
void focusOtherInstance()
|
||||||
{
|
{
|
||||||
QNetworkReply *rep = networkManager().get(QNetworkRequest(getFocusUrl()));
|
std::unique_ptr<QNetworkReply> reply(networkManager().get(QNetworkRequest(getFocusUrl())));
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
QObject::connect(rep, &QNetworkReply::finished, &loop, &QEventLoop::quit);
|
QObject::connect(reply.get(), &QNetworkReply::finished, &loop, &QEventLoop::quit);
|
||||||
loop.exec();
|
loop.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user