diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2017-03-02 16:47:29 +0100 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2017-03-03 05:51:07 +0000 |
commit | c7edb365f6c9c3d614fb6bb2fe03de3dd6d2d5a8 (patch) | |
tree | 6f32e12bc077e11a4e4d006b963ef8e0e9f833c4 /src/core | |
parent | 741faecb20b2a951d4aa3c58e98eab1b33725267 (diff) |
Fix browser process crash when IBus is enabled
Change-Id: Ic48b34473c808bcfdc80acdccab4883a8e9d5715
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/render_widget_host_view_qt.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 46057c3e4..870b19eef 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -823,14 +823,22 @@ QVariant RenderWidgetHostViewQt::inputMethodQuery(Qt::InputMethodQuery query) case Qt::ImFont: return QVariant(); case Qt::ImCursorRectangle: + // QIBusPlatformInputContext might query ImCursorRectangle before the + // RenderWidgetHostView is created. Without an available view GetSelectionRange() + // returns nullptr. + if (!GetTextInputManager()->GetSelectionRegion()) + return QVariant(); return toQt(GetTextInputManager()->GetSelectionRegion()->caret_rect); case Qt::ImCursorPosition: + Q_ASSERT(GetTextInputManager()->GetSelectionRegion()); return toQt(GetTextInputManager()->GetSelectionRegion()->focus.edge_top_rounded().x()); case Qt::ImAnchorPosition: + Q_ASSERT(GetTextInputManager()->GetSelectionRegion()); return toQt(GetTextInputManager()->GetSelectionRegion()->anchor.edge_top_rounded().x()); case Qt::ImSurroundingText: return m_surroundingText; case Qt::ImCurrentSelection: { + Q_ASSERT(GetTextInputManager()->GetTextSelection()); base::string16 text; GetTextInputManager()->GetTextSelection()->GetSelectedText(&text); return toQt(text); |