Skip to content

Fix some leaks in the linux folder watcher - #1120

Merged
TheOneRing merged 2 commits into
mainfrom
work/folder_watcher
Sep 30, 2026
Merged

TheOneRing merged 2 commits into
mainfrom
work/folder_watcher

Conversation

@TheOneRing

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Unresolved critical path-lifetime and inotify event-handling issues remain.

Review effort: Lite
Findings: 1 High severity · 1 Medium severity

Open (2)
What changed in this PR

Fixes Linux inotify event handling and folder-watcher cleanup.

Changes:

  • Improves event parsing, buffering, and path handling.
  • Cleans up ignored watches and recursive watch mappings.
  • Normalizes paths and checks filesystem state.
File Description
src/​gui/​folderwatcher_linux.cpp Updates inotify processing, path handling, and watch cleanup.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/gui/folderwatcher_linux.cpp Resolved
Comment on lines +196 to +197
if (fileName.startsWith(".sync_"_L1)) {
continue;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The old file names are no longer used.

void FolderWatcherPrivate::inotifyRegisterPath(const QString &path)
{
if (path.isEmpty()) {
Q_ASSERT(false);

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.

Hm, a Q_ASSERT(!path.isEmpty()); outside the if would be more meaningful to me

Q_ASSERT(false);
return;
}
const auto folderPath = Utility::ensureTrailingSlash(path);

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.

is that really needed? Called with an empty path, this results in root. It is caught here, but well... if somebody removes the isEmpty()- check in some day...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If one day someone shoots themselves in the foot... the unit tests will capture it or maybe not.
Future problem.

@TheOneRing
TheOneRing merged commit 0991f6e into main Sep 30, 2026
14 of 15 checks passed
@TheOneRing
TheOneRing deleted the work/folder_watcher branch September 30, 2026 08:33
@openclouders openclouders mentioned this pull request Nov 13, 2026
1 task
@saw-jan saw-jan mentioned this pull request Nov 25, 2026
9 of 22 tasks
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.

3 participants