From 46ec8c66ac6090f03b292ef0193d6fd26dd81fff Mon Sep 17 00:00:00 2001 From: diamondburned Date: Sat, 24 Oct 2020 18:13:33 -0700 Subject: [PATCH] fixed parent == nil assertion fail --- internal/ui/messages/container/cozy/message_full.go | 1 + internal/ui/messages/container/grid.go | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/ui/messages/container/cozy/message_full.go b/internal/ui/messages/container/cozy/message_full.go index 190c774..523634d 100644 --- a/internal/ui/messages/container/cozy/message_full.go +++ b/internal/ui/messages/container/cozy/message_full.go @@ -112,6 +112,7 @@ func (m *FullMessage) Unwrap(grid *gtk.Grid) *message.GenericContainer { // Remove GenericContainer's widgets from the containers. m.HeaderBox.Remove(m.Username) m.HeaderBox.Remove(m.Timestamp) + m.MainBox.Remove(m.HeaderBox) m.MainBox.Remove(m.Content) // Hide the avatar. diff --git a/internal/ui/messages/container/grid.go b/internal/ui/messages/container/grid.go index ec73855..c276a19 100644 --- a/internal/ui/messages/container/grid.go +++ b/internal/ui/messages/container/grid.go @@ -112,16 +112,16 @@ func (c *GridStore) SwapMessage(msg GridMessage) bool { // downwards. c.Grid.InsertRow(ix) + // Delete the to-be-replaced message, which we have shifted downwards + // earlier, so we add 1. + c.Grid.RemoveRow(ix + 1) + // Let the new message be attached on top of the to-be-replaced message. c.attachGrid(ix, m.Attach()) // Set the message into the map. c.messages[m.ID()] = m - // Delete the to-be-replaced message, which we have shifted downwards - // earlier, so we add 1. - c.Grid.RemoveRow(ix + 1) - return true }