fix(gui): prevent nullptr dereference when VFS mode is unavailable#10176
fix(gui): prevent nullptr dereference when VFS mode is unavailable#10176troed wants to merge 1 commit into
Conversation
nilsding
left a comment
There was a problem hiding this comment.
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)
desktop/src/gui/accountsettings.cpp
Line 772 in c866329
mgallien
left a comment
There was a problem hiding this comment.
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
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>
|
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. |
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)