diff --git a/Telegram/Controls/Gallery/GalleryWindow.xaml.cs b/Telegram/Controls/Gallery/GalleryWindow.xaml.cs index fa969aaed..5399082e7 100644 --- a/Telegram/Controls/Gallery/GalleryWindow.xaml.cs +++ b/Telegram/Controls/Gallery/GalleryWindow.xaml.cs @@ -479,10 +479,10 @@ protected override void OnBackRequestedOverride(object sender, BackRequestedRout var root = LayoutRoot.CurrentElement; if (root != null && root.IsLoaded && IsConstrainedToRootBounds && !_lastFullScreen) { - var animation = ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("FullScreenPicture", root); - if (animation != null) + if (_closing.TryGetTarget(out FrameworkElement element) && element.IsConnected()) { - if (_closing.TryGetTarget(out FrameworkElement element) && element.IsConnected()) + var animation = ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("FullScreenPicture", root); + if (animation != null) { void handler(ConnectedAnimation s, object e) { diff --git a/Telegram/ViewModels/Gallery/GalleryMessage.cs b/Telegram/ViewModels/Gallery/GalleryMessage.cs index 76f162dd7..0b351f4e7 100644 --- a/Telegram/ViewModels/Gallery/GalleryMessage.cs +++ b/Telegram/ViewModels/Gallery/GalleryMessage.cs @@ -19,7 +19,8 @@ public partial class GalleryMessage : GalleryMedia public GalleryMessage(IClientService clientService, Message message) : base(clientService) { - _message = message; + // Create a copy so that content doesn't get updated while the gallery is open + _message = new(message.Id, message.SenderId, message.ChatId, message.SendingState, message.SchedulingState, message.IsOutgoing, message.IsPinned, message.IsFromOffline, message.CanBeSaved, message.HasTimestampedMedia, message.IsChannelPost, message.IsTopicMessage, message.ContainsUnreadMention, message.Date, message.EditDate, message.ForwardInfo, message.ImportInfo, message.InteractionInfo, message.UnreadReactions, message.FactCheck, message.ReplyTo, message.MessageThreadId, message.SavedMessagesTopicId, message.SelfDestructType, message.SelfDestructIn, message.AutoDeleteIn, message.ViaBotUserId, message.SenderBusinessBotUserId, message.SenderBoostCount, message.AuthorSignature, message.MediaAlbumId, message.EffectId, message.HasSensitiveContent, message.RestrictionReason, message.Content, message.ReplyMarkup); if (clientService.TryGetChat(message.ChatId, out Chat chat)) {