[geary] Conversation images don't show w/ Vala 0.23.1: Closes bgno#721000
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary] Conversation images don't show w/ Vala 0.23.1: Closes bgno#721000
- Date: Tue, 7 Jan 2014 02:20:01 +0000 (UTC)
commit 56d31a38dc972e5dcdb7aa1eae03728c834b5c90
Author: Jim Nelson <jim yorba org>
Date: Mon Jan 6 18:18:18 2014 -0800
Conversation images don't show w/ Vala 0.23.1: Closes bgno#721000
Vala 0.23.1 introduced a change to how array .length property is
evaluated when transferring ownership to a method. See
bgno#721001 for more information.
.../conversation-viewer/conversation-viewer.vala | 4 +++-
.../conversation-viewer/conversation-web-view.vala | 8 ++++++--
src/client/util/util-webkit.vala | 5 +++--
3 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-viewer.vala
b/src/client/conversation-viewer/conversation-viewer.vala
index 5ef8d01..f4b2094 100644
--- a/src/client/conversation-viewer/conversation-viewer.vala
+++ b/src/client/conversation-viewer/conversation-viewer.vala
@@ -747,7 +747,9 @@ public class ConversationViewer : Gtk.Box {
uint8[] image_data;
pixbuf.save_to_buffer(out image_data, "png", "compression", "5");
- rotated_image = new Geary.Memory.ByteBuffer.take((owned) image_data, image_data.length);
+ // Save length before transferring ownership (which frees the array)
+ int image_length = image_data.length;
+ rotated_image = new Geary.Memory.ByteBuffer.take((owned) image_data, image_length);
}
} catch (Error err) {
debug("Unable to load and rotate image %s for display: %s", filename, err.message);
diff --git a/src/client/conversation-viewer/conversation-web-view.vala
b/src/client/conversation-viewer/conversation-web-view.vala
index dc876d4..10d95c8 100644
--- a/src/client/conversation-viewer/conversation-web-view.vala
+++ b/src/client/conversation-viewer/conversation-web-view.vala
@@ -210,8 +210,10 @@ public class ConversationWebView : WebKit.WebView {
if (icon_content == null || icon_content.length == 0)
return;
+ // Save length before transferring ownership (which frees the array)
+ int icon_length = icon_content.length;
Geary.Memory.ByteBuffer buffer = new Geary.Memory.ByteBuffer.take((owned) icon_content,
- icon_content.length);
+ icon_length);
// Then set the source to a data url.
WebKit.DOM.HTMLImageElement img = Util.DOM.select(get_dom_document(), selector)
@@ -254,8 +256,10 @@ public class ConversationWebView : WebKit.WebView {
}
// Then set the source to a data url.
+ // Save length before transferring ownership (which frees the array)
+ int content_length = content.length;
Geary.Memory.Buffer buffer = new Geary.Memory.ByteBuffer.take((owned) content,
- content.length);
+ content_length);
img.set_attribute("src", assemble_data_uri(icon_mime_type, buffer));
} catch (Error error) {
warning("Failed to load image '%s': %s", filename, error.message);
diff --git a/src/client/util/util-webkit.vala b/src/client/util/util-webkit.vala
index fddec3a..1abe751 100644
--- a/src/client/util/util-webkit.vala
+++ b/src/client/util/util-webkit.vala
@@ -438,8 +438,9 @@ public bool dissasemble_data_uri(string uri, out Geary.Memory.Buffer? buffer) {
uint8[] bytes = Base64.decode((string) (((char *) uri) + start_index));
// transfer ownership of the byte array directly to the Buffer; this prevents an
- // unnecessary copy
- buffer = new Geary.Memory.ByteBuffer.take((owned) bytes, bytes.length);
+ // unnecessary copy ... save length before transferring ownership (which frees the array)
+ int bytes_length = bytes.length;
+ buffer = new Geary.Memory.ByteBuffer.take((owned) bytes, bytes_length);
return true;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]