[geary: 5/5] Fix another avatar-related critical.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary: 5/5] Fix another avatar-related critical.
- Date: Thu, 7 Dec 2017 13:02:54 +0000 (UTC)
commit b627fd4fc6a0bc212b646336ed0206a8f1e768d5
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 8752f83..2c01e9e 100644
--- a/src/client/conversation-viewer/conversation-message.vala
+++ b/src/client/conversation-viewer/conversation-message.vala
@@ -429,10 +429,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]