Results 1 to 4 of 4

Thread: QFileWatcher infinite loop and can't move a folder which is watched

  1. #1
    Join Date
    May 2013
    Posts
    320
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default QFileWatcher infinite loop and can't move a folder which is watched

    Hi everybody!
    Let say there is an hierarchy of folder like that:

    Qt Code:
    1. FolderA
    2. FolderB1
    3. FolderB2
    4. FolderC
    To copy to clipboard, switch view to plain text mode 

    There is a QFileWatcher with addpath for each folder to watch absolutely all the hierarchy of folder.
    The signal is connected to the QFileWatcher to know when to refresh the tree.

    There is two problems that I can see and I need the light of experts on it:

    1) If you try to delete FolderA on Windows Explorer, your application ends to an infinite loop. I tried a custom filewatcher from GitHub, this infinite loop is not present anymore. Qt bug?
    2) If you try to move Folder B1 in FolderC on Windows Explorer, Windows Explorer says the operation is impossible, surely because of the filewatcher. But on other applications that update automatically on this same kind of things, like Unreal Engine, I can see it possible.

    For the point number 1, it looks a Qt bug.
    For the point number 2, I wonder if there is a trick to fix this impossible action.

    Thanks!

  2. #2
    Join Date
    May 2013
    Posts
    320
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QFileWatcher infinite loop and can't move a folder which is watched

    Solved, QFileWatcher is not enough robust, you need to use an external file watcher code from Qt to be robust.

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,854
    Thanks
    271
    Thanked 788 Times in 778 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: QFileWatcher infinite loop and can't move a folder which is watched

    you need to use an external file watcher
    Can you post the GitHub link where you found this? Thanks.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  4. #4
    Join Date
    May 2013
    Posts
    320
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QFileWatcher infinite loop and can't move a folder which is watched

    https://github.com/SpartanJ/efsw
    Just, the best file watcher actually there, working perfectly!

  5. The following user says thank you to Alundra for this useful post:

    d_stranz (26th February 2021)

Similar Threads

  1. Qt window resize without infinite loop
    By rpvpqq in forum Newbie
    Replies: 1
    Last Post: 15th April 2019, 17:34
  2. QThread : how to stop an infinite loop
    By TarielVincent in forum Qt Programming
    Replies: 9
    Last Post: 24th February 2012, 22:22
  3. Infinite loop in QXmlSchemaValidator::validate()?
    By TropicalPenguin in forum Qt Programming
    Replies: 0
    Last Post: 9th November 2010, 16:09
  4. infinite loop
    By zakis in forum Qt Programming
    Replies: 1
    Last Post: 4th November 2009, 18:52
  5. Infinite loop - resize parent from child
    By bitChanger in forum Qt Programming
    Replies: 3
    Last Post: 5th May 2006, 14:21

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.