-
Notifications
You must be signed in to change notification settings - Fork 816
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
Fix crash in Folder::isSyncRunning() #3586
Conversation
@@ -252,7 +252,7 @@ bool Folder::isBusy() const | |||
|
|||
bool Folder::isSyncRunning() const | |||
{ | |||
return _engine->isSyncRunning() || _vfs->isHydrating(); | |||
return _engine->isSyncRunning() || (_vfs && _vfs->isHydrating()); |
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.
Is it okay to have no _vfs object or is that a state that should not be encountered?
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.
Is it okay to have no _vfs object or is that a state that should not be encountered?
@FlexW I see that in void Folder::wipeForRemoval()
the _vfs
is set to nullptr
. Also, in some other methods, there is a check for not null _vfs
.
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 Just confirmed under the debugger. void Folder::wipeForRemoval()
is called before bool Folder::isSyncRunning() const
, hence, _vfs
is already set to nullptr
. So, that check is needed.
_vfs.reset(nullptr); // warning: folder now in an invalid state
That comment, though, is weird. Not sure if it's ok to have _vfs
set to nullptr
here 😕
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.
when is Folder::wipeForRemoval()
called before calling into Folder::isSyncRunning
?
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 Just confirmed under the debugger.
void Folder::wipeForRemoval()
is called beforebool Folder::isSyncRunning() const
, hence,_vfs
is already set tonullptr
. So, that check is needed.
_vfs.reset(nullptr); // warning: folder now in an invalid state
That comment, though, is weird. Not sure if it's ok to have_vfs
set tonullptr
here confused
looks like other code expect that so I would say that even if weird seems the original author idea
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.
when is
Folder::wipeForRemoval()
called before calling intoFolder::isSyncRunning
?
@mgallien This happens when requesting a remote wipe. That's how I was able to discover this crash. I am sure we need to add this check now. Otherwise, I have no other idea how to fix it quickly.
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.
can you quickly try to extend the tests in TestFolderMan
class to call into Folder::isSyncRunning()
?
that would be nice
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.
@mgallien Done.
/rebase |
00eadef
to
e69511c
Compare
/rebase |
Signed-off-by: allexzander <blackslayer4@gmail.com>
Signed-off-by: allexzander <blackslayer4@gmail.com>
e69511c
to
88d18fd
Compare
AppImage file: Nextcloud-PR-3586-88d18fd5f31380387e30792d86607cfa7b4fd792-x86_64.AppImage |
Signed-off-by: allexzander blackslayer4@gmail.com