Skip to content

qt-qml: Reply to QML Preview file requests on errors - #620

Open
shyamnathp wants to merge 1 commit into
qt-labs:devfrom
shyamnathp:bug/vscodeext-preview-file-request
Open

shyamnathp wants to merge 1 commit into
qt-labs:devfrom
shyamnathp:bug/vscodeext-preview-file-request

Conversation

@shyamnathp

@shyamnathp shyamnathp commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Noticed when a PySide6 file explorer example was run in QML Preview. The example lists the home directory, so Qt sends a Request to the extension for every path it visits. Reading ~/.Trash failed with EPERM: operation not permitted, scandir. The extension logged the failure but sent no reply. Qt waits for an answer to every Request, so the app froze.

Cause: the onPathRequested listener has no error handling. Any exception while handling a Request skips the reply.

Fix: catch the error, log it, and answer with an Error command so Qt continues. Also track the loaded file in the path map and the file watcher.

A unit test covers the error reply (QML Preview path request handling). QmlPreviewCommand is now exported so the test can build a Request packet.

Related issue in JIRA

VSCODEEXT-361

We found this while running a PySide6 file explorer example in QML
Preview. The example lists the home directory, so Qt sends a Request
to the extension for every path it visits. Reading ~/.Trash failed
with "EPERM: operation not permitted, scandir". The exception skipped
the reply, Qt kept waiting for an answer and the app froze.

Catch the error, log it and answer with an Error command, so Qt
continues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants