Skip to content

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

Open
troed wants to merge 1 commit into
nextcloud:masterfrom
troed:nullptr
Open

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

Conversation

@troed

@troed troed commented Jun 12, 2026

Copy link
Copy Markdown

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
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 <github@troed.se>
@troed

troed commented Jun 15, 2026

Copy link
Copy Markdown
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
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.

5 participants