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

Stable Qt's crash when QMenu item looses focus.

    XMLWordPrintable

Details

    • All
    • 5c3b5efd40b3ab14cc6406a0dca62dfb14b03d46 (qt/qtbase/5.15)

    Description

      Compile and run sample.cpp attached.

      Press right mouse button inside main window. You will see context menu.

      Put focus on top-level spinbox and make any change to value.

      Move mouse cursor to submenu, open it, and put focus to spinbox just appeard.

      Make any change to value, and just move mouse cursor to empty space inside main window. In about 1...2 second program will crash.

      If comment source line marked with comment, the crash will disappear.

      After some investigations I found the line in Qt's source code, that leads to crash.

      $QT_SRC\qtbase\src\widgets\kernel\qapplication.cpp:3789 (for 5.14.0 version)

      This is inside function

      void QApplicationPrivate::closePopup(QWidget *popup)

      { ...  if (QApplicationPrivate::popupWidgets->count() == 1) // grab mouse/keyboard grabForPopup(aw);   ... }

      The variable QApplicationPrivate::popupWidgets becomes NULL in my test case.

      I've changed the line to

       if (QApplicationPrivate::popupWidgets && QApplicationPrivate::popupWidgets->count() == 1) // grab mouse/keyboard
       

      and crash disappeared.

       

      Attachments

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

        Activity

          People

            chehrlic Christian Ehrlicher
            cooler Cooler
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes