Skip to content

Add automatic snapshot capture on sandbox close - #5493

Draft
love-code-yeyixiao wants to merge 5 commits into
sandboxie-plus:masterfrom
love-code-yeyixiao:AutoSnapCapture
Draft

Add automatic snapshot capture on sandbox close#5493
love-code-yeyixiao wants to merge 5 commits into
sandboxie-plus:masterfrom
love-code-yeyixiao:AutoSnapCapture

Conversation

@love-code-yeyixiao

@love-code-yeyixiao love-code-yeyixiao commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

In OptionsWindow.ui, add a new checkbox chkAutoSnapCapture to automatically capture a snapshot when the last sandbox process terminates, and adjust the position and properties of related controls. Update the global settings to save this option.

In the OnBoxClosed function in SandMan.cpp, add a check for AutoSnapCapture to ensure that a snapshot is automatically captured and logged when the sandbox closes.

In OptionsGeneral.cpp, update the LoadGeneral and SaveGeneral functions to load and save the AutoSnapCapture option settings.

在 `OptionsWindow.ui` 中新增复选框 `chkAutoSnapCapture`,用于在最后一个沙盒进程终止时自动捕获快照,并调整相关控件的位置和属性。更新全局设置以保存该选项。

在 `SandMan.cpp` 的 `OnBoxClosed` 函数中添加对 `AutoSnapCapture` 的检查,确保在沙盒关闭时自动捕获快照并记录日志。

在 `OptionsGeneral.cpp` 中更新 `LoadGeneral` 和 `SaveGeneral` 函数,以加载和保存 `AutoSnapCapture` 选项的设置。
@love-code-yeyixiao love-code-yeyixiao changed the title 添加自动快照捕获功能 Add AutoSnaphost Capture Jul 27, 2026
@isaak654 isaak654 changed the title Add AutoSnaphost Capture Add automatic snapshot capture on sandbox close Jul 27, 2026
@offhub offhub added the User Interface Related to Plus and/or Classic UIs label Jul 27, 2026
在 `OptionsWindow.ui` 文件中,多个控件的行号进行了调整,以改善界面布局和用户体验。具体包括 `verticalSpacer_2`、`horizontalSpacer_4`、`chkRawDiskNotify`、`chkRawDiskRead` 和 `chkAllowEfs` 的行号变化。

在 `OptionsGeneral.cpp` 文件中,新增了对 `chkAutoSnapCapture` 复选框的信号连接,以便在用户点击时触发 `OnGeneralChanged` 槽函数,更新界面状态。
@love-code-yeyixiao
love-code-yeyixiao marked this pull request as ready for review July 30, 2026 09:51
@isaak654
isaak654 force-pushed the master branch 2 times, most recently from ee85d32 to bf5091e Compare August 15, 2026 22:07
@DavidXanatos

Copy link
Copy Markdown
Member

please resove the conflict with the latest code base

@offhub offhub added the Feature: Snapshot Issues with the snapshot feature of Plus UI label Aug 16, 2026
@love-code-yeyixiao
love-code-yeyixiao marked this pull request as draft August 18, 2026 10:11
@offhub

offhub commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

@love-code-yeyixiao When AutoSnapCapture and AutoDelete are enabled together, AutoSnapCapture moves the files into a snapshot before auto-recovery runs. As a result, auto-recovery finds no files and does not display the recovery prompt. No files are lost, but this may confuse users who expect the recovery prompt to appear.

Enhanced `CSandMan::OnBoxClosed` to include an auto-snapshot
mechanism via a new `TakeAutoSnap` lambda function. Updated
`OpenRecovery` to support an additional `pbTakeSnapshot`
parameter, enabling snapshots after recovery. Adjusted
relevant UI and logic in `RecoveryWindow` to integrate
snapshot functionality with delete operations.
@love-code-yeyixiao
love-code-yeyixiao marked this pull request as ready for review August 21, 2026 15:09
@love-code-yeyixiao

Copy link
Copy Markdown
Contributor Author

it now works well on my Win11 VM.

@Kizuno18

Kizuno18 commented Sep 9, 2026

Copy link
Copy Markdown

I found two failure-path problems in OnBoxClosed when automatic snapshots and automatic deletion are combined.

TakeSnapshot is synchronous and returns SB_PROGRESS errors such as SB_SnapMkDirFail, SB_SnapCopyDatFail, or a failed folder move, but the result was discarded and DeleteBoxContent ran immediately afterward. A failed snapshot could therefore still be followed by content deletion. Also, choosing the new plain Delete Content menu action sets IsTakeSnapshot() to false, but bAutoSnap || TakeSnapshot forced a snapshot anyway. Canceling the recovery dialog had the opposite inconsistency: it aborted deletion but still created a snapshot despite the comment saying capture happens immediately before deletion.

The fix checks and reports the snapshot result, aborts deletion on failure, preserves automatic capture when no recovery dialog is needed, and lets the dialog's primary/dropdown choice decide whether a snapshot is taken when the dialog is shown. I verified the cancel, empty-dialog, plain-delete, capture-success, and capture-failure branches with an actual-source regression harness; the PR UI also parses successfully with Qt 6.8.3 uic.

Kizuno18/sbxie@f409cca...461f69a

@isaak654
isaak654 marked this pull request as draft September 9, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature: Snapshot Issues with the snapshot feature of Plus UI User Interface Related to Plus and/or Classic UIs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants