From 25fa931443c7c96b4787e377ddceb5594bdba173 Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Mon, 10 May 2021 15:49:09 +0300 Subject: [PATCH] UI: ConfManager: Simplify applySavedConf(). --- src/ui/conf/confmanager.cpp | 10 +++------- src/ui/rpc/confmanagerrpc.cpp | 4 ++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ui/conf/confmanager.cpp b/src/ui/conf/confmanager.cpp index becc518b..4281c38d 100644 --- a/src/ui/conf/confmanager.cpp +++ b/src/ui/conf/confmanager.cpp @@ -513,14 +513,10 @@ bool ConfManager::saveConf(FirewallConf &conf) void ConfManager::applySavedConf(FirewallConf *newConf) { - const bool onlyFlags = !newConf->optEdited(); - - if (onlyFlags && !newConf->anyEdited()) { - if (newConf != conf()) { - newConf->deleteLater(); // RPC leftover - } + if (!newConf->anyEdited()) return; - } + + const bool onlyFlags = !newConf->optEdited(); if (conf() != newConf) { if (onlyFlags) { diff --git a/src/ui/rpc/confmanagerrpc.cpp b/src/ui/rpc/confmanagerrpc.cpp index 148451ba..cddf06e6 100644 --- a/src/ui/rpc/confmanagerrpc.cpp +++ b/src/ui/rpc/confmanagerrpc.cpp @@ -63,5 +63,9 @@ bool ConfManagerRpc::saveConf(FirewallConf &newConf) // Already applied by onConfChanged() & applySavedConf() newConf.resetEdited(); + if (&newConf != conf()) { + newConf.deleteLater(); + } + return true; }