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

Calling `QWidget::winId` can sometimes cause crashes on Windows

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.9.5
    • 5.6.2
    • None
    • Windows 10
      Visual Studio 2013
      Qt 5.6.2
      PyQt 5.6
      Python 3.5.4
    • 9de2ef6f5ab3b21b4e1679e010ee488193cb41e4 (qtbase/5.9, 17.1.2018, 5.9.5), c9e0e8d5712b848cd15f343d4d1ebf475d1b7d77 (qtbase/5.6, 17.1.2018, 5.6.4)

    Description

      We've observed the following (rather rare) crashes when calling `QWidget::winId`, which we do commonly in our code to query the underlying platform windows (in this case, Win32):

      Qt5Widgets.dll!QWidgetPrivate::create_sys(unsigned int window, bool initializeWindow, bool destroyOldWindow) Line 1472  C++
      Qt5Widgets.dll!QWidget::create(unsigned int window, bool initializeWindow, bool destroyOldWindow) Line 1335 C++
      Qt5Widgets.dll!QWidgetPrivate::createWinId() Line 2561  C++
      Qt5Widgets.dll!QWidget::winId() Line 2530   C++
      QtWidgets.pyd!meth_QWidget_winId(_object * sipSelf, _object * sipArgs) Line 7581    C++
      

      The crash happens when calling win->handle()>setFrameStrutEventsEnabled(true);, because win>handle() returns NULL. It appears that win>create() can sometimes fail to create a platform window handle and that this isn't handled properly.

      Attachments

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

        Activity

          People

            kleint Friedemann Kleint
            maxbelanger Max Belanger
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes