Android: guard against potential null pointer access
androidPlatformIntegration might be called before setAndroidPlatformIntegration() is called, and also all other uses of androidPlatformIntegration is already guarded in our code. Pick-to: 6.2 6.3 Task-number: QTBUG-100470 Change-Id: Ifd7d36ba7f2f3b55652466825d7fd84c87ec5e19 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
This commit is contained in:
parent
f46db29d8c
commit
6696134644
@ -654,22 +654,26 @@ void QAndroidInputContext::updateSelectionHandles()
|
||||
QPoint leftPoint(qPlatformWindow->mapToGlobal(leftRect.bottomLeft().toPoint()));
|
||||
QPoint rightPoint(qPlatformWindow->mapToGlobal(rightRect.bottomRight().toPoint()));
|
||||
|
||||
if (m_selectHandleWidth == 0)
|
||||
m_selectHandleWidth = QtAndroidInput::getSelectHandleWidth() / 2;
|
||||
int rightSideOfScreen = QtAndroid::androidPlatformIntegration()->screen()->availableGeometry().right();
|
||||
if (leftPoint.x() < m_selectHandleWidth)
|
||||
leftPoint.setX(m_selectHandleWidth);
|
||||
QAndroidPlatformIntegration *platformIntegration = QtAndroid::androidPlatformIntegration();
|
||||
if (platformIntegration) {
|
||||
if (m_selectHandleWidth == 0)
|
||||
m_selectHandleWidth = QtAndroidInput::getSelectHandleWidth() / 2;
|
||||
|
||||
if (rightPoint.x() > rightSideOfScreen - m_selectHandleWidth)
|
||||
rightPoint.setX(rightSideOfScreen - m_selectHandleWidth);
|
||||
int rightSideOfScreen = platformIntegration->screen()->availableGeometry().right();
|
||||
if (leftPoint.x() < m_selectHandleWidth)
|
||||
leftPoint.setX(m_selectHandleWidth);
|
||||
|
||||
QPoint editPoint(qPlatformWindow->mapToGlobal(leftRect.united(rightRect).topLeft().toPoint()));
|
||||
uint32_t buttons = readOnly ? EditContext::CopyButton | EditContext::SelectAllButton
|
||||
: EditContext::AllButtons;
|
||||
if (rightPoint.x() > rightSideOfScreen - m_selectHandleWidth)
|
||||
rightPoint.setX(rightSideOfScreen - m_selectHandleWidth);
|
||||
|
||||
QtAndroidInput::updateHandles(m_handleMode, editPoint, buttons, leftPoint, rightPoint,
|
||||
query.value(Qt::ImCurrentSelection).toString().isRightToLeft());
|
||||
m_hideCursorHandleTimer.stop();
|
||||
QPoint editPoint(qPlatformWindow->mapToGlobal(leftRect.united(rightRect).topLeft().toPoint()));
|
||||
uint32_t buttons = readOnly ? EditContext::CopyButton | EditContext::SelectAllButton
|
||||
: EditContext::AllButtons;
|
||||
|
||||
QtAndroidInput::updateHandles(m_handleMode, editPoint, buttons, leftPoint, rightPoint,
|
||||
query.value(Qt::ImCurrentSelection).toString().isRightToLeft());
|
||||
m_hideCursorHandleTimer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -491,8 +491,10 @@ void QAndroidPlatformIntegration::setScreenOrientation(Qt::ScreenOrientation cur
|
||||
|
||||
void QAndroidPlatformIntegration::flushPendingUpdates()
|
||||
{
|
||||
m_primaryScreen->setSizeParameters(m_defaultPhysicalSize, m_defaultScreenSize,
|
||||
m_defaultAvailableGeometry);
|
||||
if (m_primaryScreen) {
|
||||
m_primaryScreen->setSizeParameters(m_defaultPhysicalSize, m_defaultScreenSize,
|
||||
m_defaultAvailableGeometry);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
|
Loading…
Reference in New Issue
Block a user