[geary/geary-0.12] Fix another avatar-related critical.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/geary-0.12] Fix another avatar-related critical.
- Date: Tue, 12 Dec 2017 13:14:46 +0000 (UTC)
commit 0a036e0813aa3f594e2237e45e473ed87d66658a
Author: Michael James Gratton <mike vee net>
Date: Fri Dec 8 00:00:48 2017 +1100
Fix another avatar-related critical.
* src/client/conversation-viewer/conversation-message.vala
(ConversationMessage.load_avatar): We are very occasionally getting
crashes calling Gtk.Image.get_pixel_size() due to the image is null -
maybe a race? This obviates the problem by hard-coding the size instead
of dynamically getting it.
.../conversation-viewer/conversation-message.vala | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-message.vala
b/src/client/conversation-viewer/conversation-message.vala
index 55f77c9..922b172 100644
--- a/src/client/conversation-viewer/conversation-message.vala
+++ b/src/client/conversation-viewer/conversation-message.vala
@@ -435,10 +435,18 @@ public class ConversationMessage : Gtk.Grid {
*/
public async void load_avatar(ConversationListBox.AvatarStore loader,
Cancellable load_cancelled) {
+ const int PIXEL_SIZE = 32;
Geary.RFC822.MailboxAddress? primary = message.get_primary_originator();
if (primary != null) {
int window_scale = get_scale_factor();
- int pixel_size = this.avatar.get_pixel_size() * window_scale;
+ // We occasionally get crashes calling as below
+ // Gtk.Image.get_pixel_size() when the image is
+ // null. There's perhaps some race going on there. So we
+ // need to hard-code the size and keep it in sync with
+ // ui/conversation-message.ui. :(
+ //
+ //int pixel_size = this.avatar.get_pixel_size() * window_scale;
+ int pixel_size = PIXEL_SIZE * window_scale;
try {
Gdk.Pixbuf? avatar_buf = yield loader.load(
primary, pixel_size, load_cancelled
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]