diff --git a/include/wx/msw/rt/utils.h b/include/wx/msw/rt/utils.h index b315531090..213dfe41b7 100644 --- a/include/wx/msw/rt/utils.h +++ b/include/wx/msw/rt/utils.h @@ -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; diff --git a/src/msw/rt/notifmsgrt.cpp b/src/msw/rt/notifmsgrt.cpp index 1f7e7fd1a3..3b9ba571ce 100644 --- a/src/msw/rt/notifmsgrt.cpp +++ b/src/msw/rt/notifmsgrt.cpp @@ -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 factory; @@ -215,7 +215,7 @@ public: if ( SUCCEEDED(hr) ) { wxCOMPtr 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 inputText; - HRESULT hr = xml->CreateTextNode(rt::TempStringRef::Make(str), &inputText); + HRESULT hr = xml->CreateTextNode(rt::TempStringRef(str), &inputText); if ( SUCCEEDED(hr) ) { wxCOMPtr inputTextNode; diff --git a/src/msw/rt/utilsrt.cpp b/src/msw/rt/utilsrt.cpp index c21c7fe55a..ec2fb3491e 100644 --- a/src/msw/rt/utilsrt.cpp +++ b/src/msw/rt/utilsrt.cpp @@ -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);