2 Attachment(s)
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:
Code:
QModel index = proxyModel->mapToSource(currentIndex);
if(!index.isValid())
{
return;
}
But if I click the QTreeView items quickly, it maybe crash at
Code:
proxyModel->mapToSource(currentIndex);
I don't know why.
And here is the call stack and screenshots:
Attachment 9294Attachment 9295
Code:
> QtGuid4.
dll!QSortFilterProxyModelPrivate
::index_to_iterator(const QModelIndex & proxy_index
) Line
193 + 0x8 bytes C
++ QtGuid4.
dll!QSortFilterProxyModelPrivate
::proxy_to_source(const QModelIndex & proxy_index
) Line
369 C
++ TBXXA.exe!MainWindow::onSaveBtnClicked() Line 341 + 0x2a bytes C++
TBXXA.
exe!MainWindow
::onTreeViewDoubleClicked(const QModelIndex & index
) Line
452 C
++ TBXXA.
exe!MainWindow
::qt_static_metacall(QObject * _o,
QMetaObject::Call _c,
int _id,
void * * _a
) Line
84 C
++ QtGuid4.
dll!QFrame::event(QEvent * e
) Line
557 + 0xc bytes C
++ QtGuid4.
dll!QAbstractScrollAreaPrivate
::viewportEvent(QEvent * event
) Line
100 + 0x28 bytes C
++ QtGuid4.
dll!QAbstractScrollAreaFilter
::eventFilter(QObject * o,
QEvent * e
) Line
116 + 0x29 bytes C
++ QtCored4.
dll!QCoreApplicationPrivate
::sendThroughObjectEventFilters(QObject * receiver,
QEvent * event
) Line
1056 + 0x15 bytes C
++ QtGuid4.
dll!QApplicationPrivate
::notify_helper(QObject * receiver,
QEvent * e
) Line
4558 + 0x11 bytes C
++ QtGuid4.
dll!QApplicationPrivate
::sendMouseEvent(QWidget * receiver,
QMouseEvent * event,
QWidget * alienWidget,
QWidget * nativeWidget,
QWidget * * buttonDown, QPointer<QWidget>
& lastMouseReceiver,
bool spontaneous
) Line
3171 + 0xe bytes C
++ QtGuid4.dll!QETWidget::translateMouseEvent(const tagMSG & msg) Line 3365 + 0x2a bytes C++
QtGuid4.dll!QtWndProc(HWND__ * hwnd, unsigned int message, unsigned int wParam, long lParam) Line 1698 + 0xc bytes C++
user32.dll!7689c4e7()
[Frames below may be incorrect and/or missing, no symbols loaded for user32.dll]
user32.dll!7689c5e7()
user32.dll!7689c590()
user32.dll!7689cc19()
user32.dll!7689cc70()
QtCored4.
dll!QEventDispatcherWin32
::processEvents(QFlags<enum
QEventLoop::ProcessEventsFlag> flags
) Line
810 C
++ QtGuid4.
dll!QGuiEventDispatcherWin32
::processEvents(QFlags<enum
QEventLoop::ProcessEventsFlag> flags
) Line
1204 + 0x15 bytes C
++ QtCored4.
dll!QEventLoop::processEvents(QFlags<enum
QEventLoop::ProcessEventsFlag> flags
) Line
150 C
++ QtCored4.
dll!QEventLoop::exec(QFlags<enum
QEventLoop::ProcessEventsFlag> flags
) Line
204 + 0x2d bytes C
++ TBXXA.exe!main(int argc, char * * argv) Line 32 + 0x6 bytes C++
TBXXA.exe!WinMain(HINSTANCE__ * instance, HINSTANCE__ * prevInstance, char * __formal, int cmdShow) Line 131 + 0x12 bytes C++
TBXXA.exe!__tmainCRTStartup() Line 547 + 0x2c bytes C
TBXXA.exe!WinMainCRTStartup() Line 371 C
kernel32.dll!75fbed6c()
ntdll.dll!76e6377b()
ntdll.dll!76e6374e()
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?