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

QQuickWidget will crash if the quickwidget is deleted while handling a QDrag in an invokable call.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.5.1
    • Quick: Widget
    • None
    • Windows 8.1, VS2015, Qt 5.5.1 (Snapshot 153)

    Description

      This is not necessarily a bug as we're doing stuff that QtQuick isn't designed for, but I thought I'd bring it up anyway.

      We do our own handling of drag/drop events as the current QtQuick implementation was/is full of blocker bugs (i.e. stickyness of the active property / dropping mimeData is problematic - https://bugreports.qt.io/browse/QTBUG-40773)

      We essentially have the a qquickwidget inside a tabwidget (similar to a word processor setup). From a mousearea inside the quickwidget we handle the mouse press/move/release/enter/exit and send it to C++). On a text drag we start our own QDrag(). Unfortunately as this is an invokable, it's started in the QML thread. A user then pressed ctrl+w to close the current document (while still holding the mouse button down for the drag), which was handled as a global shortcut event. This was processed and the tab was closed and deleted (and the quickwidget->DeleteLater()). The QQuickWidget was therefore deleted while still waiting the QDrag to finish and died.

      The assert is:

      ASSERT: "context() && engine()" in file qml\qqmlboundsignal.cpp, line 183
      

      The stack is as follows:

      0	NtUserWaitMessage	USER32		0x7ffbeec0104a	
      1	DialogBox2	USER32		0x7ffbeec35bc7	
      2	InternalDialogBox	USER32		0x7ffbeec37732	
      3	SoftModalMessageBox	USER32		0x7ffbeec399f2	
      4	MessageBoxWorker	USER32		0x7ffbeec3918d	
      5	MessageBoxTimeoutW	USER32		0x7ffbeec8812a	
      6	MessageBoxW	USER32		0x7ffbeec8819e	
      7	__crtMessageBoxW	crtmbox.c	250	0x7ffbbb017509	
      8	__crtMessageWindowW	dbgrpt.c	391	0x7ffbbb00be1b	
      9	_VCrtDbgReportW	dbgrptt.c	672	0x7ffbbb016b36	
      10	_CrtDbgReportWV	dbgrpt.c	263	0x7ffbbb00b3b0	
      11	_CrtDbgReportW	dbgrpt.c	279	0x7ffbbb00b340	
      12	qt_message_fatal	qlogging.cpp	1567	0x6ee8a57a	
      13	QMessageLogger::fatal	qlogging.cpp	781	0x6ee88de6	
      14	qt_assert	qglobal.cpp	2967	0x6ee7e422	
      15	QQmlBoundSignalExpression::function	qqmlboundsignal.cpp	183	0x69bdc005	
      16	QQmlBoundSignalExpression::sourceLocation	qqmlboundsignal.cpp	155	0x69bdbcfd	
      17	QQmlData::destroyed	qqmlengine.cpp	1710	0x69b9f06f	
      18	QQmlData::destroyed	qqmlengine.cpp	675	0x69b9e907	
      19	QObject::~QObject	qobject.cpp	917	0x6f28d2a9	
      20	QQuickItem::~QQuickItem	qquickitem.cpp	2289	0x7ffbba88c43a	
      21	QQuickMouseArea::~QQuickMouseArea	qquickmousearea.cpp	441	0x7ffbba99e6b2	
      22	QQmlPrivate::QQmlElement<QQuickMouseArea>::~QQmlElement<QQuickMouseArea>	qqmlprivate.h	98	0x7ffbba915e2d	
      23	QQmlPrivate::QQmlElement<QQuickMouseArea>::`scalar deleting destructor'	Qt5Quickd		0x7ffbba917d57	
      24	QObjectPrivate::deleteChildren	qobject.cpp	1946	0x6f2935d6	
      25	QObject::~QObject	qobject.cpp	1026	0x6f28d7c0	
      26	QQuickItem::~QQuickItem	qquickitem.cpp	2289	0x7ffbba88c43a	
      27	QQuickRectangle::~QQuickRectangle	Qt5Quickd		0x7ffbba8b8193	
      28	QQmlPrivate::QQmlElement<QQuickRectangle>::~QQmlElement<QQuickRectangle>	qqmlprivate.h	98	0x7ffbba9163cd	
      29	QQmlPrivate::QQmlElement<QQuickRectangle>::`scalar deleting destructor'	Qt5Quickd		0x7ffbba9182f7	
      30	QQuickWidget::~QQuickWidget	qquickwidget.cpp	403	0x7ffbd5af2e26	
      31	QQuickWidget::`scalar deleting destructor'	QQuickWidgetCrashWhileDragging		0x7ff7e3ac5c38	
      32	qDeleteInEventHandler	qobject.cpp	4455	0x6f294f8a	
      33	QObject::event	qobject.cpp	1231	0x6f28d908	
      34	QWidget::event	qwidget.cpp	9105	0x6e45a51e	
      35	QQuickWidget::event	qquickwidget.cpp	1170	0x7ffbd5af51d7	
      36	QApplicationPrivate::notify_helper	qapplication.cpp	3716	0x6e3f1fb6	
      37	QApplication::notify	qapplication.cpp	3681	0x6e3ef773	
      38	QCoreApplication::notifyInternal	qcoreapplication.cpp	965	0x6f23c9a4	
      39	QCoreApplication::sendEvent	qcoreapplication.h	224	0x6f246ff3	
      40	QCoreApplicationPrivate::sendPostedEvents	qcoreapplication.cpp	1593	0x6f23de4d	
      41	QEventDispatcherWin32::sendPostedEvents	qeventdispatcher_win.cpp	1242	0x6f2ee46a	
      42	QWindowsGuiEventDispatcher::sendPostedEvents	qwindowsguieventdispatcher.cpp	84	0x7ffbba4b91b4	
      43	qt_internal_proc	qeventdispatcher_win.cpp	416	0x6f2ebe78	
      44	UserCallWinProcCheckWow	USER32		0x7ffbeec0250d	
      45	DispatchMessageWorker	USER32		0x7ffbeec02367	
      46	CDragOperation::HandleMessages	drag.cpp	2230	0x7ffbed1dc9a4	
      47	DoDragDrop	drag.cpp	2632	0x7ffbed1ddba7	
      48	QWindowsDrag::drag	qwindowsdrag.cpp	811	0x7ffbba507fe6	
      49	QDragManager::drag	qdnd.cpp	135	0x7ffbbb1e5080	
      50	QDrag::exec	qdrag.cpp	274	0x7ffbbb1e2831	
      51	QDrag::exec	qdrag.cpp	231	0x7ffbbb1e26de	
      52	MouseHandler::HandleMouseMove	mousehandler.cpp	39	0x7ff7e3ac63bf	
      53	MouseHandler::qt_static_metacall	moc_mousehandler.cpp	85	0x7ff7e3ac6cdb	
      54	MouseHandler::qt_metacall	moc_mousehandler.cpp	119	0x7ff7e3ac6a97	
      55	QMetaObject::metacall	qmetaobject.cpp	297	0x6f24a724	
      56	QQmlObjectOrGadget::metacall	qqmlpropertycache.cpp	1690	0x69c3c3b7	
      57	CallMethod	qv4qobjectwrapper.cpp	1157	0x69b4dbf0	
      58	CallPrecise	qv4qobjectwrapper.cpp	1404	0x69b4e8dd	
      59	QV4::QObjectMethod::callInternal	qv4qobjectwrapper.cpp	1893	0x69b4b1db	
      60	QV4::QObjectMethod::call	qv4qobjectwrapper.cpp	1829	0x69b4aba7	
      61	QV4::Object::call	qv4object_p.h	305	0x698259f5	
      62	QV4::Runtime::callProperty	qv4runtime.cpp	977	0x69b70a75	
      63				0x824c1d0ebb	
      64				0x824a364180	
      65				0x8200000031	
      66				0x824c2f10b8	
      67	malloc	dbgmalloc.c	56	0x7ffbbb011e9a	
      

      We have since prevented the ctrl+w action from executing while a drag in in progress.

      You may recreate the issue in the following program, by clicking and dragging the red square. While still holding down the drag, hold ctrl+w and move the mouse. The program will assert after some mouse movement.

      Attachments

        Issue Links

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

          Activity

            People

              tvete Paul Olav Tvete
              lmv Luke
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes