Skip to content

fix(gui): prevent nullptr dereference when VFS mode is unavailable - #10176

Merged
nilsding merged 1 commit into
nextcloud:masterfrom
troed:nullptr
Jun 16, 2026
Merged

fix(gui): prevent nullptr dereference when VFS mode is unavailable#10176
nilsding merged 1 commit into
nextcloud:masterfrom
troed:nullptr

Conversation

@troed

@troed troed commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Prevent reaching a code path in Utility::askExperimentalVirtualFilesFeature that would cause a null pointer dereference when the necessary libraries are not available. Adding the check for Vfs::Off to AccountSettings::slotCustomContextMenuRequested stops the option to enable vfs to appear altogether in such cases.

Assisted-by: Qwen:qwen-3.6-35b-a3b

Resolves

#10174

Summary

OpenSUSE Tumbleweed has a separate package for VFS. If the user tries to enable VFS without it the previous code dereferenced a null pointer and segfaulted. This fix prevents the user from enabling the option in that case.

TODO

Checklist

AI (if applicable)

@nilsding nilsding left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for your contribution!

This change is treating the symptom (crash when activating VFS) rather than the cause (the VFS switch appearing at all). It would be better if the VFS toggle option is not shown at all when the plugin is not installed.

there is a check in AccountSettings which could be adapted to not show the VFS option if it's unavailable (i.e. mode is Vfs::Off)

Theme::instance()->showVirtualFilesOption() && !folder->virtualFilesEnabled() && Vfs::checkAvailability(folder->path(), mode)) {

@mgallien mgallien left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice find
please apply my fixes such that the code makes sense and do what is expected

the use of default by your code generator does not make sense and just rely on Q_UNREACHABLE letting the execution implicitly flow to the next statement of the select

I also assume that given the other VFS without the dialog use callback(true), you should also use it

Comment thread src/gui/guiutility.cpp Outdated
@troed

troed commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

I've changed so that execution doesn't reach the switch statement according to nilsding's suggestion. I agree this is a much better way to solve the problematic behavior that could appear on Tumbleweed.

@troed
troed requested review from mgallien and nilsding June 15, 2026 19:42
Prevent reaching a code path in Utility::askExperimentalVirtualFilesFeature that would cause a null pointer dereference.

Assisted-by: Qwen:qwen-3.6-35b-a3b
Signed-off-by: Troed S氓ngberg <[email protected]>

@mgallien mgallien left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@nilsding nilsding left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks again :>

@nilsding

Copy link
Copy Markdown
Member

/backport to stable-34.0 please

@nilsding

Copy link
Copy Markdown
Member

/backport to stable-33.0 please

@nilsding nilsding linked an issue Jun 16, 2026 that may be closed by this pull request
8 tasks
@nilsding nilsding added this to the 34.0.0 milestone Jun 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Artifact containing the AppImage: nextcloud-appimage-pr-10176.zip

Digest: sha256:0c720b2d2e2e001d940b41f7bbef2170def26bbc683e5270c6997ef5dbccd01b

To test this change/fix you can download the above artifact file, unzip it, and run it.

Please make sure to quit your existing Nextcloud app and backup your data.

@nilsding
nilsding enabled auto-merge June 16, 2026 07:05
@nilsding
nilsding merged commit 76cc062 into nextcloud:master Jun 16, 2026
20 of 21 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enabling VFS with no VFS models installed segfaults the client

5 participants