summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaiwei Li <daiweili@suitabletech.com>2016-02-24 23:11:47 -0800
committerMorten Johan Sørvig <morten.sorvig@theqtcompany.com>2016-02-25 13:06:04 +0000
commit375adf412f44466a9ef588529ebbf7f102878919 (patch)
treedb7ea3e8a073846c7a1cdff42bbfda9c95baf498
parent06aaeef105e29344420390421bfa0d910d99a7bf (diff)
Pepper: Fix crash in didChangeFocus
It's possible for didChangeFocus to get called before a pepper top level window has been created. Change-Id: Iee5e27a812e57f356f8b8e244cde9701025e5f33 Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
-rw-r--r--src/plugins/platforms/pepper/qpepperinstance_p.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/platforms/pepper/qpepperinstance_p.cpp b/src/plugins/platforms/pepper/qpepperinstance_p.cpp
index a177e4e953..02376d63d9 100644
--- a/src/plugins/platforms/pepper/qpepperinstance_p.cpp
+++ b/src/plugins/platforms/pepper/qpepperinstance_p.cpp
@@ -269,17 +269,18 @@ void QPepperInstancePrivate::didChangeView(int32_t result, const pp::View &view)
pepperIntegraion->processEvents();
}
-void QPepperInstancePrivate::didChangeFocus(int32_t result, bool hasFucus)
+void QPepperInstancePrivate::didChangeFocus(int32_t result, bool hasFocus)
{
Q_UNUSED(result);
- qCDebug(QT_PLATFORM_PEPPER_INSTANCE) << "DidChangeFocus" << hasFucus;
+ qCDebug(QT_PLATFORM_PEPPER_INSTANCE) << "DidChangeFocus" << hasFocus;
QPepperIntegration *pepperIntegration = QPepperIntegration::get();
if (!pepperIntegration)
return;
- QWindow *fucusWindow = hasFucus ? pepperIntegration->topLevelWindow()->window() : 0;
- QWindowSystemInterface::handleWindowActivated(fucusWindow, Qt::ActiveWindowFocusReason);
+ QWindow *focusWindow = hasFocus && pepperIntegration->topLevelWindow() ? pepperIntegration->topLevelWindow()->window() : 0;
+ if (focusWindow)
+ QWindowSystemInterface::handleWindowActivated(focusWindow, Qt::ActiveWindowFocusReason);
}
bool QPepperInstancePrivate::handleInputEvent(int32_t result, const pp::InputEvent &event)