fix: overlapping permission dialogs (#17318)

* fix: queue permissions dialogs

* fix: serialize plugin permission dialogs across prompt types

* fix: unit tests

* fix: move audit prompt stuff to PluginAuditManager

* fix: discard pending permission requests when plugin load is cancelled

* fix: simplify audit prompt cancellation and align denial tests with prod

* fix: queued permission prompts lost after plugin load failure
This commit is contained in:
Ian Chua authored and GitHub committed 2026-11-17 14:33:17 +08:00
1 parent 4c714ac95e
commit 0aa479f27c
8 files changed
+1616 -142

No files matched your search

+15 -6
View File
@@ -141,12 +141,21 @@ dropping the pybind holder from a non-Python thread would `DECREF` without the G
closed and `tl_script_loop` cleared before the worker exits.
A consequence of running Script on a non-main thread: the audit permission prompt is fail-closed off
the main thread. `request_permission` in `src/slic3r/plugin/PluginAuditManager.cpp` posts the dialog
with `CallAfter` and denies the current event. For a category with a persistent grant list, the grant
is saved when the user accepts, so a Script sees a denial on the first attempt and can succeed on a
later one. Create and delete have no persistent grant list, so their off-main-thread path posts only
an informational denial with no Yes/No choice and does not promise a retry. This matches the existing
behavior for the plugin-load worker and the slicing worker.
the main thread. `request_permission` in `src/slic3r/plugin/PluginAuditManager.cpp` queues the dialog
for the GUI thread and denies the current event. For permissions with persistent grants, accepting
the prompt saves a grant for a later attempt, so a Script sees a denial on the first attempt and can
succeed on a later one. Create and delete have no persistent grant: an asynchronous denial instead
shows an informational dialog, without offering an approval and without promising a retry. This
matches the behavior for the plugin-load worker and the slicing worker.
`AuditPromptQueue` serializes runtime prompts, informational denials and load-time declared-permission
prompts. Only one is shown at a time, including during a modal dialog's nested event loop. A load
worker waits for its declared-permission answer; shutdown or plugin unload cancels pending requests
and active requests whose accepted answers have not started committing, releasing waiting workers
with a denial. An accepted answer already being persisted completes before its worker is released.
A declared-permission request on the GUI thread is
denied if another prompt is active or pending, rather than blocking the GUI or opening a deferred
dialog. The queue outlives static destruction so shutdown can discard requests safely.
### Blocking UI continuation