Results 1 to 2 of 2

Thread: QSortFilterProxyModel crashed at mapToSource function in Qt 4.8.4

  1. #1
    Join Date
    Feb 2009
    Location
    Chengdu, China
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default QSortFilterProxyModel crashed at mapToSource function in Qt 4.8.4

    I use QFileSystemModel to show the directory and files. Also own class FileListModel inherits QSortFilterProxyModel. I want to only show the "html" files in my QTreeView.

    I added a SLOT to connect with doubleClicked(QModelIndex) signal. In the slot:

    Qt Code:
    1. QModel index = proxyModel->mapToSource(currentIndex);
    2. if(!index.isValid())
    3. {
    4. return;
    5. }
    To copy to clipboard, switch view to plain text mode 

    But if I click the QTreeView items quickly, it maybe crash at
    Qt Code:
    1. proxyModel->mapToSource(currentIndex);
    To copy to clipboard, switch view to plain text mode 

    I don't know why.

    And here is the call stack and screenshots:
    Crash.pngCrash2.png

    Qt Code:
    1. > QtGuid4.dll!QSortFilterProxyModelPrivate::index_to_iterator(const QModelIndex & proxy_index) Line 193 + 0x8 bytes C++
    2. QtGuid4.dll!QSortFilterProxyModelPrivate::proxy_to_source(const QModelIndex & proxy_index) Line 369 C++
    3. QtGuid4.dll!QSortFilterProxyModel::mapToSource(const QModelIndex & proxyIndex) Line 2519 + 0x10 bytes C++
    4. TBXXA.exe!MainWindow::onSaveBtnClicked() Line 341 + 0x2a bytes C++
    5. TBXXA.exe!MainWindow::onTreeViewDoubleClicked(const QModelIndex & index) Line 452 C++
    6. TBXXA.exe!MainWindow::qt_static_metacall(QObject * _o, QMetaObject::Call _c, int _id, void * * _a) Line 84 C++
    7. QtCored4.dll!QMetaObject::activate(QObject * sender, const QMetaObject * m, int local_signal_index, void * * argv) Line 3539 + 0x2e bytes C++
    8. QtGuid4.dll!QAbstractItemView::doubleClicked(const QModelIndex & _t1) Line 355 + 0x15 bytes C++
    9. QtGuid4.dll!QTreeView::mouseDoubleClickEvent(QMouseEvent * event) Line 1878 C++
    10. QtGuid4.dll!QWidget::event(QEvent * event) Line 8380 C++
    11. QtGuid4.dll!QFrame::event(QEvent * e) Line 557 + 0xc bytes C++
    12. QtGuid4.dll!QAbstractScrollArea::viewportEvent(QEvent * e) Line 1043 + 0xc bytes C++
    13. QtGuid4.dll!QAbstractItemView::viewportEvent(QEvent * event) Line 1645 C++
    14. QtGuid4.dll!QTreeView::viewportEvent(QEvent * event) Line 1258 C++
    15. QtGuid4.dll!QAbstractScrollAreaPrivate::viewportEvent(QEvent * event) Line 100 + 0x28 bytes C++
    16. QtGuid4.dll!QAbstractScrollAreaFilter::eventFilter(QObject * o, QEvent * e) Line 116 + 0x29 bytes C++
    17. QtCored4.dll!QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject * receiver, QEvent * event) Line 1056 + 0x15 bytes C++
    18. QtGuid4.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 4558 + 0x11 bytes C++
    19. QtGuid4.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 4105 + 0x2f bytes C++
    20. QtCored4.dll!QCoreApplication::notifyInternal(QObject * receiver, QEvent * event) Line 946 + 0x15 bytes C++
    21. QtCored4.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver, QEvent * event) Line 234 + 0x38 bytes C++
    22. QtGuid4.dll!QApplicationPrivate::sendMouseEvent(QWidget * receiver, QMouseEvent * event, QWidget * alienWidget, QWidget * nativeWidget, QWidget * * buttonDown, QPointer<QWidget> & lastMouseReceiver, bool spontaneous) Line 3171 + 0xe bytes C++
    23. QtGuid4.dll!QETWidget::translateMouseEvent(const tagMSG & msg) Line 3365 + 0x2a bytes C++
    24. QtGuid4.dll!QtWndProc(HWND__ * hwnd, unsigned int message, unsigned int wParam, long lParam) Line 1698 + 0xc bytes C++
    25. user32.dll!7689c4e7()
    26. [Frames below may be incorrect and/or missing, no symbols loaded for user32.dll]
    27. user32.dll!7689c5e7()
    28. user32.dll!7689c590()
    29. user32.dll!7689cc19()
    30. user32.dll!7689cc70()
    31. QtCored4.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 810 C++
    32. QtGuid4.dll!QGuiEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 1204 + 0x15 bytes C++
    33. QtCored4.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 150 C++
    34. QtCored4.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 204 + 0x2d bytes C++
    35. QtCored4.dll!QCoreApplication::exec() Line 1218 + 0x15 bytes C++
    36. QtGuid4.dll!QApplication::exec() Line 3824 C++
    37. TBXXA.exe!main(int argc, char * * argv) Line 32 + 0x6 bytes C++
    38. TBXXA.exe!WinMain(HINSTANCE__ * instance, HINSTANCE__ * prevInstance, char * __formal, int cmdShow) Line 131 + 0x12 bytes C++
    39. TBXXA.exe!__tmainCRTStartup() Line 547 + 0x2c bytes C
    40. TBXXA.exe!WinMainCRTStartup() Line 371 C
    41. kernel32.dll!75fbed6c()
    42. ntdll.dll!76e6377b()
    43. ntdll.dll!76e6374e()
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Aug 2012
    Location
    Loughborough, UK
    Posts
    29
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows

    Default Re: QSortFilterProxyModel crashed at mapToSource function in Qt 4.8.4

    I've had this working. Would need to see some code though to know more of what you're doing.


    Added after 42 minutes:


    I'm guessing that your model is returning NULL or an invalid item for the passed index?
    Last edited by rockdemon; 18th July 2013 at 11:26.

Similar Threads

  1. Invoking dll function with argument crashed
    By moiit in forum Qt Programming
    Replies: 13
    Last Post: 7th March 2012, 15:34
  2. Replies: 0
    Last Post: 8th December 2011, 02:00
  3. filterAcceptRows function in QSortFilterProxyModel
    By youngw in forum Qt Programming
    Replies: 0
    Last Post: 6th November 2010, 09:31
  4. Replies: 0
    Last Post: 7th October 2010, 20:38
  5. Replies: 3
    Last Post: 6th February 2010, 21:07

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.