From fb00ae97a37391eeb5b4610b2e896196b98740ae Mon Sep 17 00:00:00 2001 From: LI Daobing Date: Sun, 5 Jul 2026 22:12:54 -0700 Subject: [PATCH 1/3] 1 --- src/iptux/UiCoreThread.cpp | 17 ++++++++++++++++- src/iptux/UiCoreThread.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/iptux/UiCoreThread.cpp b/src/iptux/UiCoreThread.cpp index d2eabb7c..66814bb2 100644 --- a/src/iptux/UiCoreThread.cpp +++ b/src/iptux/UiCoreThread.cpp @@ -12,7 +12,6 @@ #include "config.h" #include "UiCoreThread.h" -#include #include #include @@ -111,6 +110,18 @@ void UiCoreThread::ClearAllPalFromList() { } } +struct UiCoreThreadCtx { + UiCoreThread* self; + PalKey key; +}; + +static gboolean iptux_uithread_update_pal_to_list(gpointer data) { + auto* ctx = (UiCoreThreadCtx*)data; + ctx->self->UpdatePalToListInUI(ctx->key); + delete ctx; + return G_SOURCE_REMOVE; +} + /** * 通告指定的好友信息数据已经被更新(非UI线程安全). * @param ipv4 ipv4 @@ -121,7 +132,11 @@ void UiCoreThread::ClearAllPalFromList() { */ void UiCoreThread::UpdatePalToList(PalKey palKey) { CoreThread::UpdatePalToList(palKey); + UiCoreThreadCtx* ctx = new UiCoreThreadCtx{this, palKey}; + g_main_context_invoke(NULL, iptux_uithread_update_pal_to_list, ctx); +} +void UiCoreThread::UpdatePalToListInUI(PalKey palKey) { PPalInfo ppal; GroupInfo* grpinf; SessionAbstract* session; diff --git a/src/iptux/UiCoreThread.h b/src/iptux/UiCoreThread.h index 9d8f0ddd..ebfee1e7 100644 --- a/src/iptux/UiCoreThread.h +++ b/src/iptux/UiCoreThread.h @@ -45,6 +45,7 @@ class UiCoreThread : public CoreThread { void ClearAllPalFromList() override; void UpdatePalToList(PalKey palKey) override; + void UpdatePalToListInUI(PalKey palKey); void UpdatePalToList(in_addr ipv4) override { UpdatePalToList(PalKey(ipv4, port())); } From 8d234c573ef3dedc357c49a544e5ab2a0a2fd53a Mon Sep 17 00:00:00 2001 From: LI Daobing Date: Sun, 5 Jul 2026 22:21:02 -0700 Subject: [PATCH 2/3] 1 --- src/iptux/UiCoreThreadTest.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/iptux/UiCoreThreadTest.cpp b/src/iptux/UiCoreThreadTest.cpp index be53a925..0fd546d1 100644 --- a/src/iptux/UiCoreThreadTest.cpp +++ b/src/iptux/UiCoreThreadTest.cpp @@ -1,6 +1,7 @@ #include "Application.h" #include "gtest/gtest.h" +#include "iptux-utils/utils.h" #include "iptux/TestHelper.h" #include "iptux/UiCoreThread.h" @@ -17,6 +18,7 @@ TEST(UiCoreThread, Constructor) { UiCoreThread* thread = new UiCoreThread(app, core); thread->setIgnoreTcpBindFailed(true); thread->start(); + thread->UpdatePalToList(PalKey(inAddrFromString("127.0.0.1"), 2425)); thread->stop(); delete thread; DestroyApplication(app); From d30a27ba92e1be43c7b16412c50b7093f0b4de66 Mon Sep 17 00:00:00 2001 From: LI Daobing Date: Sun, 5 Jul 2026 22:23:38 -0700 Subject: [PATCH 3/3] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/iptux/UiCoreThread.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/iptux/UiCoreThread.cpp b/src/iptux/UiCoreThread.cpp index 66814bb2..32b6852d 100644 --- a/src/iptux/UiCoreThread.cpp +++ b/src/iptux/UiCoreThread.cpp @@ -117,7 +117,9 @@ struct UiCoreThreadCtx { static gboolean iptux_uithread_update_pal_to_list(gpointer data) { auto* ctx = (UiCoreThreadCtx*)data; + ctx->self->Lock(); ctx->self->UpdatePalToListInUI(ctx->key); + ctx->self->Unlock(); delete ctx; return G_SOURCE_REMOVE; }