Uploaded image for project: 'Qt Solutions'
  1. Qt Solutions
  2. QTSOLBUG-185

Stack overflow upon deleting an editable QComboBox in a Qt/MFC app using QtWinMigrate

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • No Version
    • MFC Migration
    • None
    • VS 2012
      Qt 5.2 or 5.4
      Windows 8.1 x64
      32-bit project

    Description

      1. Start with the "step4" example MFC project in QtWinMigrate.
      2. Replace the optionsdialog.ui with the one attached.
      3. Build against Qt5.2 or 5.4 (make sure you have a matching build of QtWinMigrate as well).
      4. Run.
      5. Edit -> Options...
      6. Click the drop-down on the combo box. Click again to close it.
      7. Close the Options dialog.
      8. App will crash with stack overflow exception.

      Through some debugging, I found that the likely culprit is a sort of re-entrance issue that happens during the destruction of the combo box. Below is a partial stack trace:

      > Qt5Widgetsd.dll!QWidgetPrivate::createWinId(unsigned int winid) Line 2306 C++
      Qt5Widgetsd.dll!QWidget::create(unsigned int window, bool initializeWindow, bool destroyOldWindow) Line 1272 C++
      Qt5Widgetsd.dll!QWidgetPrivate::createWinId(unsigned int winid) Line 2309 C++
      Qt5Widgetsd.dll!QWidget::create(unsigned int window, bool initializeWindow, bool destroyOldWindow) Line 1272 C++
      Qt5Widgetsd.dll!QWidgetPrivate::createWinId(unsigned int winid) Line 2309 C++
      Qt5Widgetsd.dll!QWidget::create(unsigned int window, bool initializeWindow, bool destroyOldWindow) Line 1272 C++
      Qt5Widgetsd.dll!QWidgetPrivate::createWinId(unsigned int winid) Line 2309 C++
      Qt5Widgetsd.dll!QWidget::create(unsigned int window, bool initializeWindow, bool destroyOldWindow) Line 1272 C++
      Qt5Widgetsd.dll!QWidgetPrivate::createWinId(unsigned int winid) Line 2309 C++
      Qt5Widgetsd.dll!QWidget::create(unsigned int window, bool initializeWindow, bool destroyOldWindow) Line 1272 C++
      Qt5Widgetsd.dll!QWidgetPrivate::createWinId(unsigned int winid) Line 2309 C++
      Qt5Widgetsd.dll!QWidget::create(unsigned int window, bool initializeWindow, bool destroyOldWindow) Line 1272 C++
      Qt5Widgetsd.dll!QWidgetPrivate::createWinId(unsigned int winid) Line 2309 C++
      Qt5Widgetsd.dll!QWidget::create(unsigned int window, bool initializeWindow, bool destroyOldWindow) Line 1272 C++
      Qt5Widgetsd.dll!QWidgetPrivate::createWinId(unsigned int winid) Line 2309 C++
      Qt5Widgetsd.dll!QWidget::create(unsigned int window, bool initializeWindow, bool destroyOldWindow) Line 1272 C++
      Qt5Widgetsd.dll!QWidgetPrivate::createWinId(unsigned int winid) Line 2309 C++
      Qt5Widgetsd.dll!QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) Line 10226 C++
      Qt5Widgetsd.dll!QWidgetPrivate::enforceNativeChildren() Line 573 C++
      Qt5Widgetsd.dll!QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) Line 10223 C++
      Qt5Widgetsd.dll!QWidget::winId() Line 2274 C++
      QtSolutions_MFCMigrationFramework-headd.dll!QMfcApp::winEventFilter(tagMSG * msg, long * result) Line 417 C++
      QtSolutions_MFCMigrationFramework-headd.dll!QMfcAppEventFilter::nativeEventFilter(const QByteArray & __formal, void * message, long * result) Line 79 C++
      Qt5Cored.dll!QAbstractEventDispatcher::filterNativeEvent(const QByteArray & eventType, void * message, long * result) Line 466 C++
      qwindowsd.dll!QWindowsContext::windowsProc(HWND__ * hwnd, unsigned int message, QtWindows::WindowsEventType et, unsigned int wParam, long lParam, long * result) Line 759 C++
      qwindowsd.dll!qWindowsWndProc(HWND__ * hwnd, unsigned int message, unsigned int wParam, long lParam) Line 1073 C++
      user32.dll!76b5791c() Unknown
      [Frames below may be incorrect and/or missing, no symbols loaded for user32.dll]
      user32.dll!76b57b7a() Unknown
      user32.dll!76b57a7f() Unknown
      kernel32.dll!74d5298e() Unknown
      mfc110d.dll!AfxActivationWndProc(HWND_ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam) Line 513 C++
      user32.dll!76b5791c() Unknown
      user32.dll!76b57b7a() Unknown
      user32.dll!76b57a7f() Unknown
      user32.dll!76b57ccd() Unknown
      user32.dll!76b813d1() Unknown
      user32.dll!76b57e23() Unknown
      ntdll.dll!76f0c692() Unknown
      qwindowsd.dll!QWindowsWindow::destroyWindow() Line 981 C++
      qwindowsd.dll!QWindowsWindow::~QWindowsWindow() Line 938 C++
      qwindowsd.dll!QWindowsWindow::`scalar deleting destructor'(unsigned int) C++
      Qt5Guid.dll!QWindow::destroy() Line 1500 C++
      Qt5Widgetsd.dll!QWidgetPrivate::deleteTLSysExtra() Line 936 C++
      Qt5Widgetsd.dll!QWidget::destroy(bool destroyWindow, bool destroySubWindows) Line 209 C++
      Qt5Widgetsd.dll!QWidget::~QWidget() Line 1495 C++
      Qt5Widgetsd.dll!QFrame::~QFrame() Line 219 C++
      Qt5Widgetsd.dll!QComboBoxPrivateContainer::~QComboBoxPrivateContainer() C++
      Qt5Widgetsd.dll!QComboBoxPrivateContainer::`scalar deleting destructor'(unsigned int) C++
      Qt5Cored.dll!QObjectPrivate::deleteChildren() Line 1835 C++
      Qt5Widgetsd.dll!QWidget::~QWidget() Line 1488 C++
      Qt5Widgetsd.dll!QComboBox::~QComboBox() Line 1300 C++

      During the destroy sequence, a message comes (0x0090, WM_UAHDESTROYWINDOW) and the QMfcApp::winEventFilter processes it. This causes QWidget::winId to be called on one of the widgets being destroyed, which triggers an infinite recursion loop in QWidget, resulting in a stack overflow.

      Attachments

        Activity

          People

            Unassigned Unassigned
            dslee Douglas Lee
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: