Fix using deleted function in TempStringRef

Use the constructor directly instead of via a make function.
This commit is contained in:
Maarten Bent
2020-04-08 22:15:47 +02:00
parent 362fe04b0f
commit b20daa9fb0
3 changed files with 10 additions and 13 deletions

View File

@@ -66,11 +66,9 @@ public:
operator HSTRING() const { return m_hstring; };
static const TempStringRef Make(const wxString &str);
TempStringRef(const wxString& str);
private:
TempStringRef(const wxString &str);
HSTRING m_hstring;
HSTRING_HEADER m_header;

View File

@@ -64,7 +64,7 @@ public:
m_impl = NULL;
}
// DesktopToastActivatedEventHandler
// DesktopToastActivatedEventHandler
IFACEMETHODIMP Invoke(IToastNotification *sender, IInspectable* args);
// DesktopToastDismissedEventHandler
@@ -170,7 +170,7 @@ public:
HRESULT CreateToast(IXmlDocument *xml)
{
HRESULT hr = ms_toastMgr->CreateToastNotifierWithId(rt::TempStringRef::Make(ms_appId), &m_notifier);
HRESULT hr = ms_toastMgr->CreateToastNotifierWithId(rt::TempStringRef(ms_appId), &m_notifier);
if ( SUCCEEDED(hr) )
{
wxCOMPtr<IToastNotificationFactory> factory;
@@ -215,7 +215,7 @@ public:
if ( SUCCEEDED(hr) )
{
wxCOMPtr<IXmlNodeList> nodeList;
hr = (*toastXml)->GetElementsByTagName(rt::TempStringRef::Make("text"), &nodeList);
hr = (*toastXml)->GetElementsByTagName(rt::TempStringRef("text"), &nodeList);
if ( SUCCEEDED(hr) )
{
hr = SetNodeListValueString(0, m_title, nodeList, *toastXml);
@@ -244,7 +244,7 @@ public:
{
wxCOMPtr<IXmlText> inputText;
HRESULT hr = xml->CreateTextNode(rt::TempStringRef::Make(str), &inputText);
HRESULT hr = xml->CreateTextNode(rt::TempStringRef(str), &inputText);
if ( SUCCEEDED(hr) )
{
wxCOMPtr<IXmlNode> inputTextNode;

View File

@@ -166,15 +166,14 @@ int RTCore::ms_isAvailable = -1;
// wxWinRT::TempStringRef
//
const TempStringRef TempStringRef::Make(const wxString &str)
{
return TempStringRef(str);
}
TempStringRef::TempStringRef(const wxString &str)
: m_hstring(NULL), m_header()
{
if ( !RTCore::IsAvailable() )
{
wxLogDebug("Can not create string reference without WinRT");
return;
}
// This creates a fast-pass string which must not be deleted using WindowsDeleteString
HRESULT hr = RTCore::Get().WindowsCreateStringReference(
@@ -221,7 +220,7 @@ bool GetActivationFactory(const wxString& activatableClassId, REFIID iid, void *
if ( !RTCore::IsAvailable() )
return false;
HRESULT hr = RTCore::Get().RoGetActivationFactory(TempStringRef::Make(activatableClassId), iid, factory);
HRESULT hr = RTCore::Get().RoGetActivationFactory(TempStringRef(activatableClassId), iid, factory);
if ( FAILED(hr) )
{
wxLogDebug("RoGetActivationFactory failed %.8x", hr);