-
Notifications
You must be signed in to change notification settings - Fork 806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent crash in dialog that warns user about vfs and e2ee #3369
Prevent crash in dialog that warns user about vfs and e2ee #3369
Conversation
src/gui/accountsettings.cpp
Outdated
@@ -96,6 +101,10 @@ bool showEnableE2eeWithVirtualFilesWarningDialog() | |||
encryptButton->setText(AccountSettings::tr("Encrypt folder")); | |||
e2eeWithVirtualFilesWarningMsgBox.exec(); | |||
|
|||
SyncJournalFileRecord record; | |||
if (!folder->journalDb()->getFileRecord(path, &record) || !record.isValid()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FlexW I think this check must be made after the dialog was closed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exec() returns if the dialog was closed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FlexW Ok. But still, is it the correct place to check for folder existence? I mean, it's the code for the warning dialog, and, it will even be removed once we get the E2EE with VFS PR in, so this check will then be gone. Is it possible that the folder gets removed during us clicking the "Encrypt" even without having a warning dialog displayed? If you know what I mean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I think the check is only necessary (and I think even then it's very rare that a user might encounter that case) when the dialog is displayed. I wanted to have it close to the dialog because then it's easier to remove it once the dialog is removed.
/rebase |
7ccdb5c
to
df04668
Compare
what would you do if you were doing the "invasive" fix ? |
Use |
I am not sure we need to put so much effort into something that will later be removed. I mean, this dialog, it's a temporary solution, right? |
We should not let code we think is not good enough land because we can never know that we will for sure clean it before the next release. Once code is in, we have to live with it. The clean up is never guaranteed. We can have priorities shift that would prevent doing the clean up. |
@FlexW can you please take care of using |
df04668
to
e74bc99
Compare
src/gui/accountsettings.cpp
Outdated
@@ -339,21 +342,34 @@ void AccountSettings::slotMarkSubfolderEncrypted(FolderStatusModel::SubFolderInf | |||
|
|||
const auto folder = folderInfo->_folder; | |||
Q_ASSERT(folder); | |||
const auto path = folderInfo->_path; | |||
const auto fileId = folderInfo->_fileId; | |||
const auto encryptFolder = [this, fileId, folder, path] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure folder pointer cannot be made invalid before the lambda is called ?
QMessageBox::open
is only window modal but maybe the account and folder can be removed via the tray main dialog ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. It could make sense to pass a folder alias/name and then, request it from the FolderManager within the lambda :)
ad2053e
to
d8542dd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
please clean history before merging
/rebase |
d8542dd
to
ee73786
Compare
Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
ee73786
to
cb5e839
Compare
AppImage file: Nextcloud-PR-3369-cb5e8398c4cb04778eaa2d0cfd84377eecc8906c-x86_64.AppImage |
/backport to stable-3.2 |
Signed-off-by: Felix Weilbach felix.weilbach@nextcloud.com
I know the root cause of the problem lies in the fact that we use a pointer from a model too long, but I wanted to make this fix as non-invasive as possible.