Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-120031

xcb: Modal state may get lost due to a race

    XMLWordPrintable

Details

    • Linux/X11

    Description

      During "QXcbWindow::create", the "_NET_WM_STATE" property is changed a first time, and a second time within "QXcbWindow::show", right before finally mapping the window.
      In "create", the change is attempted by means of sending a client message
      (create->setWindowFlags->setNetWmState->xcb_send_event).
      In "show", the change is conducted by means of an "xcb_change_property" XServer request
      (show->setNetWmStateOnUnmappedWindow->xcb_change_property).

      The create-path by design can only raise a subset of the states which are eventually raised in the show-path.
      However, the second change may overtake the first one, since "xcb_change_property" is processed by the XServer directly, while the client message takes a detour through the window manager.

      In case of overtaking, the window manager (applying the subset of states) may or may not destroy the larger set of states specified in setNetWmStateOnUnmappedWindow.
      If for example the window is a modal dialog, then the _NET_WM_STATE_MODAL state will only be communicated in the show-path.
      If overtaking is very fast, then the window manager will see the already stored _NET_WM_STATE_MODAL and leave it alone (the client message only adds/removes/toggles certain other states).
      If overtaking is medium fast, then _NET_WM_STATE_MODAL may not yet be stored by the time the window manager checks the current states, but may be stored by the time the window manager writes the modifications back. Then _NET_WM_STATE_MODAL will be lost.

      The best way to avoid this race seems to be not to mix protocols.
      Either only use two calls to "xcb_change_property" or two client messages, but not both.
      On the other hand it seems as if the create-path of specifing an early set of _NET_WM_STATE is superfluous, since the show-path will apply a superset of states anyway.

       

      Looks like due to this x11vkbwrapper some time does not shows up even when it is called it via dbus and atspi libraries with showKeyboard , and following error comes up.

      x11vkbwrapper[4163]: qt.qpa.xcb: internal error: void QXcbWindow::setNetWmStateOnUnmappedWindow() called on mapped window 

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            liaqi Liang Qi
            poikelin Joni Poikelin
            Votes:
            7 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes