Fix SizeCache

Delete cleans up old data when the sandbox is renamed.
I hope to delete or refuse to write Size by default when m_TotalSize is 0. This avoids extra cleanup work.
Fix https://github.com/sandboxie-plus/Sandboxie/issues/2231
This commit is contained in:
okrc 2022-09-15 16:24:15 +08:00 committed by GitHub
parent e254b95cb2
commit 04792c218f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -237,7 +237,10 @@ void CSandBoxPlus::UpdateSize()
void CSandBoxPlus::SetSize(quint64 Size)
{
m_TotalSize = Size;
theConf->SetValue("SizeCache/" + m_Name, Size);
if (m_TotalSize == 0)
theConf->DelValue("SizeCache/" + m_Name);
else
theConf->SetValue("SizeCache/" + m_Name, Size);
}
bool CSandBoxPlus::IsSizePending() const

View File

@ -1208,6 +1208,7 @@ void CSbieView::OnSandBoxAction(QAction* Action, const QList<CSandBoxPtr>& SandB
Results.append((SandBoxes.first()->RenameBox(Value)));
RenameItem(OldValue, Value);
theConf->DelValue("SizeCache/" + OldValue);
}
else if (Action == m_pMenuRecover)
{