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

[Mac] Crash when file is dragged onto a QWidget

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.5.0 RC
    • 5.5.0 Beta
    • GUI: Drag and Drop
    • None
    • Tested on Mac OSX 10.9
    • macOS
    • 762d49399089821d1d7f13cedaab74dfa68e3357

    Description

      On Macintosh, if you have a QWidget that allows dragging, and you try to drag a file onto the widget (you don't need to even drop, just drag the file over the widget), Qt crashes with the following stack trace:

      0	QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData>>::data() const	qscopedpointer.h	135	0x100dd642c	
      1	QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData>>::pointer qGetPtrHelper<QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData>>>(QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData>> const&)	qglobal.h	983	0x100e0a295	
      2	QDrag::d_func() const	qdrag.h	53	0x100e0a30c	
      3	QDrag::dragCursor(Qt::DropAction) const	qdrag.cpp	336	0x100e0a126	
      4	-[QNSView handleDrag:]	qnsview.mm	1881	0x106932360	
      5	-[QNSView draggingEntered:]	qnsview.mm	1849	0x106931f1e	
      6	NSCoreDragTrackingProc	NSCoreDragTrackingProc		0x7fff8648f7c2	
      7	DoTrackingMessage	DoTrackingMessage		0x7fff8949aca4	
      8	CoreDragMessageHandler	CoreDragMessageHandler		0x7fff8949db36	
      9	__CFMessagePortPerform	__CFMessagePortPerform		0x7fff8ed7ec38	
      10	__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__	__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__		0x7fff8ed04829	
      11	__CFRunLoopDoSource1	__CFRunLoopDoSource1		0x7fff8ed0479e	
      12	__CFRunLoopRun	__CFRunLoopRun		0x7fff8ecf57d6	
      13	CFRunLoopRunSpecific	CFRunLoopRunSpecific		0x7fff8ecf4e75	
      14	RunCurrentEventLoopInMode	RunCurrentEventLoopInMode		0x7fff8abd9a0d	
      15	ReceiveNextEventCommon	ReceiveNextEventCommon		0x7fff8abd97b7	
      16	_BlockUntilNextEventMatchingListInModeWithFilter	_BlockUntilNextEventMatchingListInModeWithFilter		0x7fff8abd95bc	
      17	_DPSNextEvent	_DPSNextEvent		0x7fff8618324e	
      18	-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]	-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]		0x7fff8618289b	
      19	-[NSApplication run]	-[NSApplication run]		0x7fff8617699c	
      20	QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)	qcocoaeventdispatcher.mm	418	0x106939b33	
      21	QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)	qeventloop.cpp	128	0x101db8b5a	
      22	QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)	qeventloop.cpp	204	0x101db8d6c	
      23	QCoreApplication::exec()	qcoreapplication.cpp	1216	0x101dbda24	
      24	QGuiApplication::exec()	qguiapplication.cpp	1528	0x100dedfc6	
      25	QApplication::exec()	qapplication.cpp	2977	0x10005d279	
      26	main	main.cpp	10	0x100003d48	
      27	start	start		0x100003ce4	
      

      To reproduce this, create an application with the following code:

      #include <QApplication>
      #include <QPlainTextEdit>
      
      int main(int argc, char *argv[])
      {
      	QApplication a(argc, argv);
      	QPlainTextEdit w;
      	w.show();
      
      	return a.exec();
      }
      

      Then execute the application. Drag a file onto the widget. I use an image file but it seems that any file type will cause the crash.

      If I take a look at what is going on in the debugger, in qnsview.mm, within handleDrag(), the nativeDrag variable on line 1880 is NULL. It is then dereferenced in the next line (1881).

      The code that is crashing was added on March 16, 2015 by Filipe Azevedo in commit 939f21be53efabc37b7682a72effab716d8b9410.

      Attachments

        Issue Links

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

          Activity

            People

              richard Richard Moe Gustavsen
              aclight Adam Light
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes