From a5915f260ff882f3e5cf09060ffa007856a0a33f Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 6 Sep 2016 13:35:28 +0200 Subject: [PATCH] winrt: Use ComPtrs in input context By doing so we no longer leak the input pane inside the destructor. Additionally the coding style is closer to the rest of the WinRT port. Change-Id: I0d56086719c98585cec8bc3c4bcb2d86c3ea2e79 Reviewed-by: Maurice Kalinowski --- src/plugins/platforms/winrt/qwinrtinputcontext.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/winrt/qwinrtinputcontext.cpp b/src/plugins/platforms/winrt/qwinrtinputcontext.cpp index 3f476556ee..065ed28cc0 100644 --- a/src/plugins/platforms/winrt/qwinrtinputcontext.cpp +++ b/src/plugins/platforms/winrt/qwinrtinputcontext.cpp @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(lcQpaInputMethods, "qt.qpa.input.methods") -inline QRectF getInputPaneRect(IInputPane *pane, qreal scaleFactor) +inline QRectF getInputPaneRect(ComPtr pane, qreal scaleFactor) { Rect rect; pane->get_OccludedRect(&rect); @@ -85,16 +85,15 @@ QWinRTInputContext::QWinRTInputContext(QWinRTScreen *screen) { qCDebug(lcQpaInputMethods) << __FUNCTION__ << screen; - IInputPaneStatics *statics; + ComPtr statics; if (FAILED(GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_InputPane).Get(), &statics))) { qWarning("failed to retrieve input pane statics."); return; } - IInputPane *inputPane; + ComPtr inputPane; statics->GetForCurrentView(&inputPane); - statics->Release(); if (inputPane) { EventRegistrationToken showToken, hideToken; inputPane->add_Showing(Callback(