decoder: Cancel file loading on decoder drop
That will probably at least work for scrolling quickly through images. It will however usually not cancel an ongoing decoding process. Issue #155 Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/210>
This commit is contained in:
parent
6d7623b15a
commit
7c227f75a8
6 changed files with 56 additions and 48 deletions
|
|
@ -217,8 +217,9 @@ impl Decoder {
|
|||
|
||||
fn guess_format(file: &gio::File) -> anyhow::Result<Option<image_rs::ImageFormat>> {
|
||||
let mut buf = Vec::new();
|
||||
// TODO: allow to cancel
|
||||
let fs_file = file
|
||||
.to_buf_read()
|
||||
.to_buf_read(&gio::Cancellable::new())
|
||||
.context(gettext("Could not open image"))?;
|
||||
fs_file
|
||||
.take(64)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue