Skip to content

Fix GtkFileThumbnail thumbnail query

See commits. This is a relatively minor fix meant to last only until we start bigger reworks of the filechooser models and items.

From the main commit:

    filethumbnail: Set filechooser::queried after querying
    
    Setting this attribute after querying, but before receiving the
    results, can lead to inappropriate behaviour. This can be reproduced
    by dragging the scrollbar very quickly in a large directory; after
    going up and down a few times, some thumbnails will be wrong.
    
    Without this branch, "wrong" means they'll show the completely wrong
    icon or thumbnail, e.g. a folder icon in a video file. With previous
    commit, "wrong" means they'll be empty even when there is a thumbnail
    available.
    
    The sequence of events that triggers this is as follows:
    
     1. GtkListItem receives a GFileInfo object and passes it to
        GtkFileThumbnail via expressions
    
     2. `get_thumbnail()` is called, doesn't find a thumbnail
    
     3. `filechooser::queried` is not set yet, so it is set to TRUE
          and we call `g_file_query_info_async()`
    
     4. **Before `thumbnail_queried_cb` is called**, a new GFileInfo
        is set, and we cancel the query initiated in the previous
        step
    
     5. We now have a GFileInfo with `filechooser::queried` set to
        TRUE, and no thumbnail!
    
    This commit fixes that by only setting the `filechooser::queried`
    attribute after the icon is queried. We need to set it in two
    situations: when the query is successful, or when the error is
    not G_IO_ERROR_CANCELLED. That's because the query was cancelled,
    we didn't really perform it!
Edited by Georges Basile Stavracas Neto

Merge request reports