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

Crash by drag and drop in QTreeView with QFileSystemModel+QSortFilterProxyModel

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.6.3
    • 5.4.0
    • None
    • Mac 10.9.5
      Qt 5.4.0
    • bd591064be388216f91d48522b3bdbc1be93bb92

    Description

      When I try drag and drop several times in QTreeView, the app crashes.
      Please see this screencast to reproduce.
      https://www.youtube.com/watch?v=fJm7nMgMeXs

      #include <QApplication>
      #include <QTreeView>
      #include <QDebug>
      #include <QMainWindow>
      #include <QFileSystemModel>
      #include <QSortFilterProxyModel>
      
      int main(int argc, char* argv[]) {
        QApplication app(argc, argv);
      
        QTreeView tree;
        tree.setSelectionMode(QAbstractItemView::ExtendedSelection);
        tree.setDragEnabled(true);
        tree.setAcceptDrops(true);
        tree.setDropIndicatorShown(true);
        tree.setDragDropMode(QAbstractItemView::InternalMove);
      
        QString dirPath = QDir::homePath();
        QFileSystemModel* model = new QFileSystemModel();
        model->setReadOnly(false);
        model->setRootPath(dirPath);
      
        QSortFilterProxyModel* filter = new QSortFilterProxyModel;
        filter->setSourceModel(model);
        tree.setModel(filter);
      
        QDir parentDir(dirPath);
        parentDir.cdUp();
        QModelIndex rootIndex = filter->mapFromSource(model->index(parentDir.absolutePath()));
        tree.setRootIndex(rootIndex);
      
        QMainWindow win1;
        win1.show();
        QMainWindow win2;
        win2.setCentralWidget(&tree);
        win2.show();
      
        win1.setFocus();
        win2.setFocus();
      
        return app.exec();
      }
      

      Here's the crash report.

      Process:         QtTest [2283]
      Path:            /Users/USER/*/QtTest.app/Contents/MacOS/QtTest
      Identifier:      ???
      Version:         ??? (???)
      Code Type:       X86-64 (Native)
      Parent Process:  Qt Creator [555]
      Responsible:     Qt Creator [555]
      User ID:         501
      
      Date/Time:       2015-01-13 16:30:39.632 +0900
      OS Version:      Mac OS X 10.9.5 (13F34)
      Report Version:  11
      Anonymous UUID:  2065E299-2305-4E16-A4DB-D8EF3CFFFAC7
      
      
      Crashed Thread:  0  Dispatch queue: com.apple.main-thread
      
      Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
      Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
      
      VM Regions Near 0:
      --> 
          __TEXT                 0000000104f18000-0000000104f23000 [   44K] r-x/rwx SM=COW  /Users/USER/*/QtTest.app/Contents/MacOS/QtTest
      
      Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
      0   org.qt-project.QtCore         	0x0000000105dbcd74 QSortFilterProxyModelPrivate::proxy_to_source(QModelIndex const&) const + 244
      1   org.qt-project.QtCore         	0x0000000105dc6b22 QSortFilterProxyModel::mapToSource(QModelIndex const&) const + 18
      2   org.qt-project.QtCore         	0x0000000105dc4749 QSortFilterProxyModel::data(QModelIndex const&, int) const + 41
      3   org.qt-project.QtWidgets      	0x00000001051ad98b QAccessibleTableCell::state() const + 347
      4   libqcocoa.dylib               	0x0000000108a2587a QCocoaAccessible::hasValueAttribute(QAccessibleInterface*) + 58
      5   libqcocoa.dylib               	0x0000000108a2244e -[QMacAccessibilityElement accessibilityAttributeNames] + 398
      6   com.apple.AppKit              	0x00007fff925bdf3f -[NSObject(NSAccessibilityInternal) _accessibilityAttributeNamesClientError:] + 67
      7   com.apple.AppKit              	0x00007fff925bf6b1 CopyAttributeNames + 216
      8   com.apple.HIServices          	0x00007fff91157c96 _AXXMIGCopyAttributeNames + 200
      9   com.apple.HIServices          	0x00007fff91161204 _XCopyAttributeNames + 409
      10  com.apple.HIServices          	0x00007fff911408f4 mshMIGPerform + 211
      11  com.apple.CoreFoundation      	0x00007fff8829c829 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41
      12  com.apple.CoreFoundation      	0x00007fff8829c79e __CFRunLoopDoSource1 + 478
      13  com.apple.CoreFoundation      	0x00007fff8828d7d6 __CFRunLoopRun + 1830
      14  com.apple.CoreFoundation      	0x00007fff8828ce75 CFRunLoopRunSpecific + 309
      15  com.apple.HIToolbox           	0x00007fff86496a0d RunCurrentEventLoopInMode + 226
      16  com.apple.HIToolbox           	0x00007fff864967b7 ReceiveNextEventCommon + 479
      17  com.apple.HIToolbox           	0x00007fff864965bc _BlockUntilNextEventMatchingListInModeWithFilter + 65
      18  com.apple.AppKit              	0x00007fff9223e24e _DPSNextEvent + 1434
      19  com.apple.AppKit              	0x00007fff9223d89b -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122
      20  com.apple.AppKit              	0x00007fff9223199c -[NSApplication run] + 553
      21  libqcocoa.dylib               	0x0000000108a0f92d QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 2189
      22  org.qt-project.QtCore         	0x0000000105dec5ad QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 381
      23  org.qt-project.QtCore         	0x0000000105def58a QCoreApplication::exec() + 346
      24                                	0x0000000104f1aad9 main + 825 (main.cpp:41)
      25  libdyld.dylib                 	0x00007fff88a2b5fd start + 1
      

      Attachments

        Issue Links

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

          Activity

            People

              andysh Andy Shaw
              shinichy Shinichi Katayama
              Votes:
              8 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes