Skip to content
  • Philip Withnall's avatar
    gdesktopappinfo: Allocate DesktopFileDir structs dynamically · bffe0585
    Philip Withnall authored
    `DesktopFileDir` pointers are passed around between threads: they are
    initially created on the main thread, but a pointer to them is passed to
    the GLib worker thread in the file monitor callback
    (`desktop_file_dir_changed()`).
    
    Accordingly, the `DesktopFileDir` objects either have to be
     (1) immutable;
     (2) reference counted; or
     (3) synchronised between the two threads
    to avoid one of them being used by one thread after being freed on
    another. Option (1) changed with commit 99bc33b6
    
     and is no longer an
    option. Option (3) would mean blocking the main thread on the worker
    thread, which would be hard to achieve and is against the point of
    having a worker thread. So that leaves option (2), which is implemented
    here.
    
    Signed-off-by: default avatarPhilip Withnall <withnall@endlessm.com>
    
    Fixes: #1903
    bffe0585