Skip to content
  • Allison Karlitskaya's avatar
    NautilusFile: keep free space information directly · ba04ec0e
    Allison Karlitskaya authored
    There were previously some tricks in nautilus to this effect:
    
     - when you call nautilus_file_get_volume_free_space() on a
       NautilusFile, the return result is NULL at first and later you get a
       "changed" signal on the file after the value is filled in
    
     - the value is being stored inside the NautilusDirectory equivalent for
       the file that is created when the call is first performed and kept
       around until after the change signal fires (so that the person
       receiving the change signal can still get the data).  This is done to
       save space by not expanding NautilusFile.
    
       The NautilusDirectory is then dropped after the change signal is done
       firing.
    
     - the nautilus properties window has a 200ms timeout after changes to
       files being reported before it re-queries the properties
    
    The end result is that the NautilusDirectory (which holds the
    information about the free space) is already freed by the time the
    properties window tries to update the free space display.  This results
    in the directory being recreated and the process starting over again.
    The end result is that we never get the free space shown in the dialog
    and instead we have an infinite loop of CPU usage (fortunately repeating
    only every 200ms, so you get ~5% CPU usage instead of 100%).
    
    We can solve the problem by just storing the free space information
    directly in the NautilusFile details structure and dropping the dance
    with NautilusDirectory; nothing in NautilusDirectory is actually using
    that information anyway.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=673550
    ba04ec0e