From 6b9a9a01e289381ea915ac43595c6c5da0db73b4 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Fri, 23 May 2014 17:16:54 +0200 Subject: remove HSTRING instances HSTRING needs to be released or handles will be leaked. Instead use HString which takes care of resource management on its own. Task-Number: QTBUG-38115 Change-Id: I2c767776c1f22f45acd8dd77b693f30d63d894b9 Reviewed-by: Andrew Knight Reviewed-by: Oliver Wolff --- src/plugins/platforms/winrt/qwinrtservices.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/plugins/platforms/winrt/qwinrtservices.cpp') diff --git a/src/plugins/platforms/winrt/qwinrtservices.cpp b/src/plugins/platforms/winrt/qwinrtservices.cpp index 73c090351b..b0f9247d36 100644 --- a/src/plugins/platforms/winrt/qwinrtservices.cpp +++ b/src/plugins/platforms/winrt/qwinrtservices.cpp @@ -81,9 +81,11 @@ bool QWinRTServices::openUrl(const QUrl &url) return QPlatformServices::openUrl(url); IUriRuntimeClass *uri; - QString urlString = url.toString(); HSTRING uriString; HSTRING_HEADER header; - WindowsCreateStringReference((const wchar_t*)urlString.utf16(), urlString.length(), &header, &uriString); - m_uriFactory->CreateUri(uriString, &uri); + QString urlString = url.toString(); + // ### TODO: Replace with HStringReference when WP8.0 support is removed + HString uriString; + uriString.Set((const wchar_t*)urlString.utf16(), urlString.length()); + m_uriFactory->CreateUri(uriString.Get(), &uri); if (!uri) return false; @@ -107,10 +109,11 @@ bool QWinRTServices::openDocument(const QUrl &url) return QPlatformServices::openDocument(url); const QString pathString = QDir::toNativeSeparators(url.toLocalFile()); - HSTRING_HEADER header; HSTRING path; - WindowsCreateStringReference((const wchar_t*)pathString.utf16(), pathString.length(), &header, &path); + // ### TODO: Replace with HStringReference when WP8.0 support is removed + HString path; + path.Set((const wchar_t*)pathString.utf16(), pathString.length()); IAsyncOperation *fileOp; - m_fileFactory->GetFileFromPathAsync(path, &fileOp); + m_fileFactory->GetFileFromPathAsync(path.Get(), &fileOp); if (!fileOp) return false; -- cgit v1.2.3