diff options
Diffstat (limited to 'main/src/ui/conversation_content_view/file_image_widget.vala')
| -rw-r--r-- | main/src/ui/conversation_content_view/file_image_widget.vala | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/main/src/ui/conversation_content_view/file_image_widget.vala b/main/src/ui/conversation_content_view/file_image_widget.vala index 6efe2d58..f39dd30a 100644 --- a/main/src/ui/conversation_content_view/file_image_widget.vala +++ b/main/src/ui/conversation_content_view/file_image_widget.vala @@ -154,10 +154,20 @@ public class FileImageWidget : Widget { public async void load_from_file(File file, string file_name) throws GLib.Error { FixedRatioPicture image = new FixedRatioPicture() { min_width=100, min_height=100, max_width=600, max_height=300 }; - // Work-around because Gtk.Picture does not apply the orientation itself - Gdk.Pixbuf? pixbuf = new Pixbuf.from_file(file.get_path()); - pixbuf = pixbuf.apply_embedded_orientation(); - image.paintable = Texture.for_pixbuf(pixbuf); + FileInputStream file_stream = null; + try { + file_stream = file.read(); + // Work-around because Gtk.Picture does not apply the orientation itself + Gdk.Pixbuf? pixbuf = new Pixbuf.from_stream(file_stream); + pixbuf = pixbuf.apply_embedded_orientation(); + image.paintable = Texture.for_pixbuf(pixbuf); + } finally { + try { + if (file_stream != null) file_stream.close(); + } catch (Error e) { + // Ignore + } + } stack.add_child(image); stack.set_visible_child(image); |
