summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorMaurice Kalinowski <maurice.kalinowski@digia.com>2014-05-23 17:16:54 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-06-03 09:55:30 +0200
commit6b9a9a01e289381ea915ac43595c6c5da0db73b4 (patch)
tree68f460051ea2e42af8b5d6c7331ad5218cc1e68c /src/plugins
parent69e2d3b3e96bb1fa553acb5cd867267d1596c314 (diff)
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 <andrew.knight@digia.com> Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/winrt/qwinrtplatformmessagedialoghelper.cpp7
-rw-r--r--src/plugins/platforms/winrt/qwinrtservices.cpp15
2 files changed, 13 insertions, 9 deletions
diff --git a/src/plugins/platforms/winrt/qwinrtplatformmessagedialoghelper.cpp b/src/plugins/platforms/winrt/qwinrtplatformmessagedialoghelper.cpp
index e70d06860c..c2f884055d 100644
--- a/src/plugins/platforms/winrt/qwinrtplatformmessagedialoghelper.cpp
+++ b/src/plugins/platforms/winrt/qwinrtplatformmessagedialoghelper.cpp
@@ -171,10 +171,11 @@ void QWinRTPlatformMessageDialogHelper::hide()
HRESULT QWinRTPlatformMessageDialogHelper::onInvoked(ABI::Windows::UI::Popups::IUICommand *command)
{
- HSTRING hLabel;
+ HString hLabel;
UINT32 labelLength;
- command->get_Label(&hLabel);
- QString label = QString::fromWCharArray(::WindowsGetStringRawBuffer(hLabel, &labelLength));
+ command->get_Label(hLabel.GetAddressOf());
+ PCWSTR rawString = hLabel.GetRawBuffer(&labelLength);
+ QString label = QString::fromWCharArray(rawString, labelLength);
int buttonId = -1;
for (int i = QPlatformDialogHelper::FirstButton; i < QPlatformDialogHelper::LastButton; i<<=1) {
if ( options()->standardButtons() & i ) {
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<StorageFile*> *fileOp;
- m_fileFactory->GetFileFromPathAsync(path, &fileOp);
+ m_fileFactory->GetFileFromPathAsync(path.Get(), &fileOp);
if (!fileOp)
return false;