use stop method for protocol disconnecect

This commit is contained in:
Mykola Baibuz
2025-08-27 13:33:49 +03:00
parent f2a9940147
commit f1ec9c5c75
2 changed files with 3 additions and 5 deletions

View File

@@ -52,8 +52,9 @@ AmneziaApplication::AmneziaApplication(int &argc, char *argv[]) : AMNEZIA_BASE_C
AmneziaApplication::~AmneziaApplication()
{
if (m_vpnConnection) {
QMetaObject::invokeMethod(m_vpnConnection.get(), "disconnectSlots", Qt::QueuedConnection);
QMetaObject::invokeMethod(m_vpnConnection.get(), "disconnectFromVpn", Qt::QueuedConnection);
QThread::msleep(2000);
QMetaObject::invokeMethod(m_vpnConnection.get(), "disconnectSlots", Qt::QueuedConnection);
}
m_vpnConnectionThread.requestInterruption();

View File

@@ -445,10 +445,7 @@ void VpnConnection::disconnectFromVpn()
#ifdef AMNEZIA_DESKTOP
if (InterfaceReady()) {
if (m_vpnProtocol) {
m_vpnProtocol->deleteLater();
}
m_vpnProtocol.data()->stop();
qDebug() << "Interface is ready!";
QRemoteObjectPendingReply<bool> flushDnsResp = IpcClient::Interface()->flushDns();