From 74119ee2420439a313f50ae0906a628c4ac41863 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Mon, 30 Apr 2018 12:01:24 +0300 Subject: [PATCH] Move defer and add a debug print --- ui/messages/imagemessage.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ui/messages/imagemessage.go b/ui/messages/imagemessage.go index c9301c5..04103b4 100644 --- a/ui/messages/imagemessage.go +++ b/ui/messages/imagemessage.go @@ -59,10 +59,7 @@ func (msg *ImageMessage) RegisterMatrix(matrix ifc.MatrixContainer) { msg.matrix = matrix if len(msg.data) == 0 { - go func() { - defer debug.Recover() - msg.updateData() - }() + go msg.updateData() } } @@ -71,12 +68,14 @@ func (msg *ImageMessage) NotificationContent() string { } func (msg *ImageMessage) updateData() { + defer debug.Recover() debug.Print("Loading image:", msg.Homeserver, msg.FileID) data, _, _, err := msg.matrix.Download(fmt.Sprintf("mxc://%s/%s", msg.Homeserver, msg.FileID)) if err != nil { debug.Print("Failed to download image %s/%s: %v", msg.Homeserver, msg.FileID, err) return } + debug.Print("Image", msg.Homeserver, msg.FileID, "loaded.") msg.data = data }