Skip to content
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

Remove the lockfile on exit #14997

Merged
merged 1 commit into from
May 23, 2021
Merged

Conversation

brvphoenix
Copy link
Contributor

Test on Windows and Linux (Ubuntu 20.04 LTS).

@glassez
Copy link
Member

glassez commented May 21, 2021

@brvphoenix
What is real purpose of this change?

@brvphoenix
Copy link
Contributor Author

@brvphoenix
What is real purpose of this change?

Delete the remaining files, when qbittorrent exits.

If change the absolute path for the qbittorrent on portable mode, a different lockfile will be created and this file will not be deleted even if the qbittorrent exits. I think it is not reasonable.

@@ -130,6 +130,7 @@ bool QtLockedFile::unlock()
}

m_lock_mode = NoLock;
remove();
Copy link
Member

Choose a reason for hiding this comment

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

Please don't break file handling logic. Destroying file object (as well as unlocking file) shouldn't mean removing the file. You should explicitly unlock it and then remove in QtLocalPeer destructor instead.

Copy link
Member

Choose a reason for hiding this comment

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

Should we follow QLockFile?
~QLockFile() will delete the lock file: https://doc.qt.io/qt-5/qlockfile.html#dtor.QLockFile

Copy link
Member

Choose a reason for hiding this comment

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

Then it should not inherit the QFile, so as not to give the incorrect impression that it is just an extended version of the regular file handler.

Copy link
Member

Choose a reason for hiding this comment

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

IMO, if we want to change it so deeply it can be done in separately.

@brvphoenix brvphoenix force-pushed the lockfile branch 2 times, most recently from 0371e3b to f39af7b Compare May 22, 2021 03:19
src/app/qtlocalpeer/qtlocalpeer.h Outdated Show resolved Hide resolved
src/app/qtlocalpeer/qtlocalpeer.cpp Outdated Show resolved Hide resolved
@glassez glassez added this to the 4.4.0 milestone May 22, 2021
@Chocobo1 Chocobo1 merged commit aebb9f8 into qbittorrent:master May 23, 2021
@Chocobo1
Copy link
Member

@brvphoenix
Thank you!

@brvphoenix brvphoenix deleted the lockfile branch May 23, 2021 13:36
IceCodeNew pushed a commit to IceCodeNew/qBittorrent-Enhanced-Edition that referenced this pull request May 30, 2021
glassez pushed a commit to glassez/qBittorrent that referenced this pull request Jun 11, 2021
glassez pushed a commit that referenced this pull request Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants