D18698: [baloo/KInotify] Notify if folder was moved from unwatched place

Stefan BrĂ¼ns noreply at phabricator.kde.org
Thu Feb 7 03:21:57 GMT 2019


bruns added a comment.


  In D18698#406755 <https://phabricator.kde.org/D18698#406755>, @poboiko wrote:
  
  > Something like that? I've decided not to emit `created` signal from inside the function, just to have a bit less branching in the code (and documented this behavior, since it might be a bit confusing)
  >
  > Actually, I think this race condition is now handled properly, i.e. I can't think even of the case when we got `created` signal twice for the same file.
  
  
  Yes, looks almost fine now.
  
  It is still possible to get two "created" signals for a new file, but as said, two signals are the race we handle fine, only zero signals would be an issue:
  
    = a =
    it->next()   -- adds "foobar" to it.m_paths
    addWatch("foobar")
    = b =
    it.next(), it.next(), ... it.next()   -- siblings of "foobar"
    = c =
    it.next() -- take "foobar" from it.m_paths, instantiate QDirIterator("foobar")
    it.next(), ... it.next()  -- contents of "foobar"
    it.next() -- destruct "foobar" iterator
    = d =
  
  Any file created after =b= and before =c=  will emit "created" twice, once from the already created watcher, and once during the traversal
  Files created before =a= will be missed by the watch (thus we need the iteration), files created after =d= will only be picked up by the watcher.

INLINE COMMENTS

> kinotify.cpp:390
> +                // is installed. Ensure created events for all children are issued at least once
> +                handleDirCreated(QFile::decodeName(path));
>              }

`QFile::decodeName(path)` twice ...

> kinotify.cpp:441
> +                if (event->mask & IN_ISDIR) {
> +                    handleDirCreated(QFile::decodeName(path));
> +                }

dito ...

REPOSITORY
  R293 Baloo

REVISION DETAIL
  https://phabricator.kde.org/D18698

To: poboiko, #baloo, #frameworks, ngraham, bruns
Cc: bruns, ngraham, kde-frameworks-devel, #baloo, ashaposhnikov, michaelh, astippich, spoorun, abrahams
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190207/e1b59da0/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list