Skip to content

QsciScintilla crash on mouse click when Qt Virtual Keyboard (QT_IM_MODULE=qtvirtualkeyboard) is enabled (Windows, text present) #3

Description

@JueryWang

On Windows, QScintilla (QsciScintilla) crashes reproducibly when Qt Virtual Keyboard is enabled as the input method module. The crash happens when the editor contains any text (non-empty) and the user clicks inside the text area with the mouse (focus/caret positioning).

  • Windows

  • QScintilla (QsciScintilla)

  • Qt Virtual Keyboard enabled via environment variables:

    • QT_IM_MODULE=qtvirtualkeyboard
    • When QT_VIRTUALKEYBOARD_DESKTOP_DISABLE=0 (or unset), the virtual keyboard tries to participate on desktop and the crash is reproducible.
    • When QT_VIRTUALKEYBOARD_DESKTOP_DISABLE=1 , the virtual keyboard does not participate and the crash does not occur.
      What we tried We attempted to prevent the virtual keyboard from appearing only for QsciScintilla by disabling input methods on the editor widget:
  • setAttribute(Qt::WA_InputMethodEnabled, false)

  • Consuming IME-related events in event() (e.g. QEvent::InputMethod , QEvent::InputMethodQuery , QEvent::RequestSoftwareInputPanel , etc.)

  • Calling QGuiApplication::inputMethod()->hide() in focusInEvent() / mousePressEvent()
    However, the crash still occurs when clicking the editor text area.

Expected behavior When Qt Virtual Keyboard is enabled, QsciScintilla should not crash on mouse click / caret movement. If the widget does not support the virtual keyboard, it should safely ignore/refuse IME interaction instead of crashing.

Minimal reproduction steps

  1. On Windows, set:
    • QT_IM_MODULE=qtvirtualkeyboard
    • QT_VIRTUALKEYBOARD_DESKTOP_DISABLE=0
  2. Create a simple app with a single QsciScintilla widget.
  3. Put any text into the editor (type or setText() to non-empty).
  4. Click inside the editor text area with the mouse.
  5. Application crashes.
    Additional note Standard Qt widgets like QLineEdit can work with the virtual keyboard in the same application; the issue only triggers on the QsciScintilla click/focus/caret path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions