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

QWindowsScreenManager::removeScreen Crash

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 5.15.16
    • QPA: Windows
    • None
    • Windows

    Description

      My program crashes at QWindowsScreenManager::removeScreen
      Finally execute
      QWindowSystemInterface::handleScreenRemoved(m_screens.takeAt(index));

      Index is accessed out of bounds here. Reproduction steps:
      1. The screen moves to the following layout
      Screen 1: (1920*1080 100%)
      Screen 3: (1920*1080 100%)
      Screen 2: (2560*1440 150%) Main screen

      2. Run the demo program

      3. Removing screen 3 will trigger a crash at QWindowSystemInterface::handleScreenRemoved(m_screens.takeAt(index));

      It is recommended to determine whether index is still within the range of m_screens before executing QWindowSystemInterface::handleScreenRemoved(m_screens.takeAt(index)); to protect against this situation.

       

      I debugged the Qt source code and found that there were two calls to QWindowsScreenManager::removeScreen. The first removeScreen was executed with index 2 and screens size 3. Before the first removeScreen was completed, the second removeScreen was executed (same index 2 and screens size 3). Then the second removeScreen deleted the element with index 2. Then when the first removeScreen was executed, an out-of-bounds access occurred.

       

      Is there something wrong with what I'm using here or is there something wrong with Qt? Do you have any more suggestions? Thank you very much~

      Attachments

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

        Activity

          People

            morteza.jamshidi Morteza Jamshidi
            jayce Jie Gao
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes