From 2c7d25129869e691199e7387b9a335863447e9fd Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sat, 19 Apr 2025 21:30:54 +0900 Subject: [PATCH] cmd/rpcfetch: update act in ui thread --- cmd/rpcfetch/apply.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/cmd/rpcfetch/apply.go b/cmd/rpcfetch/apply.go index c8474c6..4ab24e0 100644 --- a/cmd/rpcfetch/apply.go +++ b/cmd/rpcfetch/apply.go @@ -84,15 +84,17 @@ func apply() { act := *prof.Activity s := &applyState{} - act.State = s.replace(act.State) - act.Details = s.replace(act.Details) - act.Timestamps = &discord.ActivityTimestamps{Start: launchTime.Unix()} - act.Assets = &discord.ActivityAssets{ - LargeImage: act.Assets.LargeImage, - LargeText: s.replace(act.Assets.LargeText), - SmallImage: act.Assets.SmallImage, - SmallText: s.replace(act.Assets.SmallText), - } + fyne.DoAndWait(func() { + act.State = s.replace(act.State) + act.Details = s.replace(act.Details) + act.Timestamps = &discord.ActivityTimestamps{Start: launchTime.Unix()} + act.Assets = &discord.ActivityAssets{ + LargeImage: act.Assets.LargeImage, + LargeText: s.replace(act.Assets.LargeText), + SmallImage: act.Assets.SmallImage, + SmallText: s.replace(act.Assets.SmallText), + } + }) confLock.RUnlock() if nonce, err := retry(&act, s); err != nil {