Skip to content

With marks enabled, ViewFileList will lock FileDatas and may not unlock them, leading to a FileData leak #2408

Open

Description

@xsdg

Setup (please complete the following information):

  • Distribution: [e.g. Ubuntu] Debian
  • Distribution release: [e.g. 20.04] unstable
  • Geeqie version [geeqie --version]: HEAD as of 971d766

Describe the bug
I added the lock feature in 1ea9251. This was to counteract a behavior where files in the current directory that were hidden because of marks, would be unreffed and freed, and when the marks filter was lifted, they would need to be completely reloaded.

In hindsight, it would probably be better to add a ref at some point when using marks, rather than to bypass the refcounting feature entirely.

To reproduce
With FD_VERBOSE_DEBUG enabled, I run ./build/src/geeqie --file=/tmp/gq_test/imgs/, then scroll around a bit, then change directory to the parent directory, which is otherwise empty. Then I exit Geeqie, which triggers the FileData dump.

Expected behavior
There should be very few FileData instances still in memory (likely in the file cache), and there should be none with a refcount of 0.

Actual behavior
A number of FileData instances are still in memory, with ref == 0. This is only possible when they are still locked.

0    /tmp/gq_test/imgs/sample_640×426.pbm
    r -> 1 @ ../src/filedata/filedata.cc:2999
    r -> 2 @ ../src/view-file/view-file-list.cc:912
    r -> 3 @ ../src/filecache.cc:222
    u -> 2 @ ../src/filecache.cc:68
    r -> 3 @ ../src/filedata/filedata.cc:2999
    u -> 2 @ ../src/filedata/filelist.cc:356
    r -> 3 @ ../src/filedata/filedata.cc:2999
    u -> 2 @ ../src/filedata/filelist.cc:356
    r -> 3 @ ../src/filecache.cc:222
    u -> 2 @ ../src/filecache.cc:68
    r -> 3 @ ../src/image.cc:769
    r -> 4 @ ../src/image.cc:1117
    u -> 3 @ ../src/image.cc:706
    r -> 4 @ ../src/image-load.cc:298
    r -> 5 @ ../src/filecache.cc:222
    r -> 6 @ ../src/filedata/filedata.cc:2782
    r -> 7 @ ../src/bar.cc:440
    r -> 8 @ ../src/bar-histogram.cc:129
    r -> 9 @ ../src/bar-comment.cc:142
    r -> 10 @ ../src/bar-keywords.cc:260
    r -> 11 @ ../src/bar-comment.cc:142
    r -> 12 @ ../src/bar-rating.cc:73
    r -> 13 @ ../src/bar-exif.cc:341
    u -> 12 @ ../src/filedata/filedata.cc:2821
    u -> 11 @ ../src/image.cc:1116
    u -> 10 @ ../src/image-load.cc:275
    u -> 9 @ ../src/bar.cc:439
    u -> 8 @ ../src/bar-histogram.cc:128
    u -> 7 @ ../src/bar-comment.cc:141
    u -> 6 @ ../src/bar-keywords.cc:259
    u -> 5 @ ../src/bar-comment.cc:141
    u -> 4 @ ../src/bar-rating.cc:72
    u -> 3 @ ../src/bar-exif.cc:340
    u -> 2 @ ../src/filecache.cc:68
    u -> 1 @ ../src/view-file/view-file-list.cc:154
    u -> 0 @ ../src/filedata/filelist.cc:356
0    /tmp/gq_test/imgs/curtin01.jps
[...]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions