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

Windows/MFCMigrationFramework: Crash during application shutdown due to dereference of null QGuiApplicationPrivate::qt_clipboard

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • 5.3.1
    • 5.2.1
    • Other
    • None
    • Windows 7 amd64
    • a6855cbf4046b8f5c7c4571631a722009828d578 (6.6.2014, stable, 5.3.1)?

    Description

      Our app sometimes crashes on shutdown with the following stack:

       	Qt5Cored.dll!QScopedPointer<QObjectData,QScopedPointerDeleter<QObjectData> >::data()  Line 143	C++
       	Qt5Cored.dll!qGetPtrHelper<QScopedPointer<QObjectData,QScopedPointerDeleter<QObjectData> > >()  Line 919	C++
       	Qt5Cored.dll!QObject::d_func()  Line 118	C++
       	Qt5Cored.dll!QMetaObject::activate()  Line 3454	C++
       	Qt5Cored.dll!QMetaObject::activate()  Line 3445	C++
       	Qt5Guid.dll!QClipboard::dataChanged()  Line 175	C++
       	Qt5Guid.dll!QClipboard::emitChanged()  Line 547	C++
       	Qt5Guid.dll!QPlatformClipboard::emitChanged()  Line 127	C++
       	qwindowsd.dll!QWindowsClipboard::clipboardViewerWndProc()  Line 242	C++
       	qwindowsd.dll!qClipboardViewerWndProc()  Line 130	C++
       	user32.dll!UserCallWinProcCheckWow() 	
       	user32.dll!DispatchClientMessage() 	
       	user32.dll!__fnDWORD() 	
       	ntdll.dll!KiUserCallbackDispatcherContinue() 	
       	user32.dll!NtUserChangeClipboardChain() 	
       	qwindowsd.dll!QWindowsClipboard::unregisterViewer()  Line 176	C++
       	qwindowsd.dll!QWindowsClipboard::~QWindowsClipboard()  Line 146	C++
       	qwindowsd.dll!QWindowsIntegrationPrivate::~QWindowsIntegrationPrivate()  Line 365	C++
       	qwindowsd.dll!QWindowsIntegrationPrivate::`scalar deleting destructor'() 	C++
       	qwindowsd.dll!QScopedPointerDeleter<QWindowsIntegrationPrivate>::cleanup()  Line 62	C++
       	qwindowsd.dll!QScopedPointer<QWindowsIntegrationPrivate,QScopedPointerDeleter<QWindowsIntegrationPrivate> >::~QScopedPointer<QWindowsIntegrationPrivate,QScopedPointerDeleter<QWindowsIntegrationPrivate> >()  Line 110	C++
       	qwindowsd.dll!QWindowsIntegration::~QWindowsIntegration()  Line 380	C++
       	qwindowsd.dll!QWindowsIntegration::`scalar deleting destructor'() 	C++
       	Qt5Guid.dll!QGuiApplicationPrivate::~QGuiApplicationPrivate()  Line 1210	C++
       	Qt5Widgetsd.dll!QApplicationPrivate::~QApplicationPrivate()  Line 174	C++
       	Qt5Widgetsd.dll!QApplicationPrivate::`vector deleting destructor'() 	C++
       	Qt5Cored.dll!QScopedPointerDeleter<QObjectData>::cleanup()  Line 62	C++
       	Qt5Cored.dll!QScopedPointer<QObjectData,QScopedPointerDeleter<QObjectData> >::~QScopedPointer<QObjectData,QScopedPointerDeleter<QObjectData> >()  Line 110	C++
       	Qt5Cored.dll!QObject::~QObject()  Line 940	C++
       	Qt5Cored.dll!QCoreApplication::~QCoreApplication()  Line 787	C++
      >	Qt5Guid.dll!QGuiApplication::~QGuiApplication()  Line 526	C++
       	Qt5Widgetsd.dll!QApplication::~QApplication()  Line 757	C++
       	QtSolutions_MFCMigrationFramework-2.8d.dll!000007fef3e53ec6() 	
       	[Frames below may be incorrect and/or missing, no symbols loaded for QtSolutions_MFCMigrationFramework-2.8d.dll]	
       	unittest2.exe!QMfcApp::`scalar deleting destructor'() 	C++
       	unittest2.exe!std::default_delete<QMfcApp>::operator()()  Line 2068	C++
       	unittest2.exe!std::unique_ptr<QMfcApp,std::default_delete<QMfcApp> >::_Delete()  Line 2345	C++
       	unittest2.exe!std::unique_ptr<QMfcApp,std::default_delete<QMfcApp> >::~unique_ptr<QMfcApp,std::default_delete<QMfcApp> >()  Line 2302	C++
       	unittest2.exe!main()  Line 559	C++
       	unittest2.exe!__tmainCRTStartup()  Line 555	C
       	unittest2.exe!mainCRTStartup()  Line 371	C
       	kernel32.dll!BaseThreadInitThunk() 	
       	ntdll.dll!RtlUserThreadStart() 	
      

      This crash occurs because QGuiApplication::~QGuiApplication() (shallower on the stack) has already set QGuiApplicationPrivate::qt_clipboard to null, and now (deeper on the stack) QPlatformClipboard::emitChanged() is blindly dereferencing QGuiApplication::clipboard().

      I believe the fix would be to have QPlatformClipboard::emitChanged() actually check for null rather than blindly dereferencing.

      Attachments

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

        Activity

          People

            kleint Friedemann Kleint
            kkelly@tableausoftware.com Keith F. Kelly
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes