This commit is contained in:
恍兮惚兮 2024-12-26 17:56:48 +08:00
parent 40fce13b1c
commit 0b9ccb4aa2

View File

@ -251,10 +251,9 @@ DECLARE_API void *add_ContextMenuRequested(void *m_host, int index, const wchar_
ICoreWebView2ContextMenuItem *sender, ICoreWebView2ContextMenuItem *sender,
IUnknown *args) IUnknown *args)
{ {
LPWSTR selecttext; wil::unique_cotaskmem_string selecttext;
CHECK_FAILURE(target->get_SelectionText(&selecttext)); CHECK_FAILURE(target->get_SelectionText(&selecttext));
callback(selecttext); callback(selecttext.get());
// 不需要freefree反而会崩溃
return S_OK; return S_OK;
}) })
.Get(), .Get(),