From 0b9ccb4aa25b1ff25bafb3857e49322fbb7118a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <1173718158@qq.com> Date: Thu, 26 Dec 2024 17:56:48 +0800 Subject: [PATCH] . --- cpp/winsharedutils/webview2_extra.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cpp/winsharedutils/webview2_extra.cpp b/cpp/winsharedutils/webview2_extra.cpp index 062bf283..45a9dd56 100644 --- a/cpp/winsharedutils/webview2_extra.cpp +++ b/cpp/winsharedutils/webview2_extra.cpp @@ -251,10 +251,9 @@ DECLARE_API void *add_ContextMenuRequested(void *m_host, int index, const wchar_ ICoreWebView2ContextMenuItem *sender, IUnknown *args) { - LPWSTR selecttext; + wil::unique_cotaskmem_string selecttext; CHECK_FAILURE(target->get_SelectionText(&selecttext)); - callback(selecttext); - // 不需要free,free反而会崩溃 + callback(selecttext.get()); return S_OK; }) .Get(),