PDA

View Full Version : Why Microsoft Visual C++ Runtime Library error in Qt 4.8.0 using win32-g++



E099844
28th September 2012, 15:06
I just transitioned my Qt project from 4.7.0 to 4.8.0 on Windows (win32-g++). After fixing the "--enable-auto-import" issue in qmake.conf I am able to build. But trying to run, it crashes with the following error. "Microsoft Visual C++ Runtime Library" "Runtime Error!":

8265

I don't even have Visual C++ installed. Same code runs perfectly in 4.7.0... Any help would be greatly appreciated.

I have more data: The actual error is:

ASSERT failure in QVector<T>::at: "index out of range", file ..\..\include/QtCore/../../src/corelib/tools/qvector.h, line 351

This occurs when I attempt to drag a QTreeWidgetItem from a QTreeWidget. AND the QTreeWidget has been filtered to display a single QTreeWidgetItem. Here's (part of) the constructor for the QTreeWidget class:


SourceTreeWidget::SourceTreeWidget(QWidget * parent):

QTreeWidget(parent), actionRename(false), sourceSearchString(""),
masterSearchString(""), sourceFiltered(false), masterFiltered(false),
_lastFilePath(DEFAULT_FILE_PATH)
{

setObjectName("SourceTreeWidget");

connect(this, SIGNAL(itemChanged(QTreeWidgetItem *, int)),
this, SLOT(changeSourceName(QTreeWidgetItem *, int)));

model()->setSupportedDragActions(Qt::CopyAction);
.
.
.

}

E099844
28th September 2012, 21:21
I was finally able to catch the back trace from the debugger:


0 ntdll!LdrAccessResource C:\WINDOWS\system32\ntdll.dll 0 0x7c90e514
1 WaitMessage C:\WINDOWS\system32\user32.dll 0 0x7e419418
2 USER32!CallMsgFilterW C:\WINDOWS\system32\user32.dll 0 0x7e42770a
3 USER32!GetCursorFrameInfo C:\WINDOWS\system32\user32.dll 0 0x7e4249c4
4 USER32!SoftModalMessageBox C:\WINDOWS\system32\user32.dll 0 0x7e43a956
5 USER32!MessageBoxIndirectA C:\WINDOWS\system32\user32.dll 0 0x7e43a2bc
6 USER32!MessageBoxTimeoutW C:\WINDOWS\system32\user32.dll 0 0x7e4663fd
7 USER32!MessageBoxTimeoutA C:\WINDOWS\system32\user32.dll 0 0x7e4664a2
8 USER32!MessageBoxExA C:\WINDOWS\system32\user32.dll 0 0x7e450877
9 USER32!MessageBoxA C:\WINDOWS\system32\user32.dll 0 0x7e45082f
10 strerror C:\WINDOWS\system32\msvcrt.dll 0 0x77c39300
11 msvcrt!_lock C:\WINDOWS\system32\msvcrt.dll 0 0x77c3b127
12 msvcrt!abort C:\WINDOWS\system32\msvcrt.dll 0 0x77c36bba
13 ?? qlist.h 395 0xa
14 qt_message qglobal.cpp 2298 0x6a10f18a
15 qFatal qglobal.cpp 2481 0x6a10f57a
16 qt_assert_x qglobal.cpp 2007 0x6a10ebcc
17 QVector<QTreeViewItem>::at qvector.h 351 0x43f7a67
18 QTreeViewPrivate::adjustViewOptionsForIndex qtreeview.cpp 1386 0x415ce9c
19 QAbstractItemViewPrivate::renderToPixmap qabstractitemview.cpp 4241 0x412f56b
20 QAbstractItemView::startDrag qabstractitemview.cpp 3529 0x412c6f9
21 QAbstractItemView::mouseMoveEvent qabstractitemview.cpp 1725 0x4125367
22 QTreeView::mouseMoveEvent qtreeview.cpp 1939 0x415fc2a
23 QWidget::event qwidget.cpp 8346 0x3c763a2
24 QFrame::event qframe.cpp 557 0x400a5b8
25 QAbstractScrollArea::viewportEvent qabstractscrollarea.cpp 1043 0x409950f
26 QAbstractItemView::viewportEvent qabstractitemview.cpp 1644 0x4124b6d
27 QTreeView::viewportEvent qtreeview.cpp 1257 0x415c8f7
28 QAbstractScrollAreaPrivate::viewportEvent qabstractscrollarea_p.h 100 0x42fbd23
29 QAbstractScrollAreaFilter::eventFilter qabstractscrollarea_p.h 116 0x42fa0e4
30 QCoreApplicationPrivate::sendThroughObjectEventFil ters qcoreapplication.cpp 986 0x6a21348
31 QApplicationPrivate::notify_helper qapplication.cpp 4546 0x3c2bfff
32 QApplication::notify qapplication.cpp 4093 0x3c2a26a
33 QCoreApplication::notifyInternal qcoreapplication.cpp 876 0x6a213252
34 QCoreApplication::sendSpontaneousEvent qcoreapplication.h 234 0x42c0246
35 QApplicationPrivate::sendMouseEvent qapplication.cpp 3159 0x3c28ad6
36 QETWidget::translateMouseEvent qapplication_win.cpp 3363 0x3c93171
37 QtWndProc qapplication_win.cpp 1696 0x3c8df66
38 USER32!GetDC C:\WINDOWS\system32\user32.dll 0 0x7e418734

amleto
28th September 2012, 21:24
you cant mix and match compilers. Qt has to be built with the same compiler as that with which your app is built.

the (release) run time library is a re-distributable and has virtually nothing to do with having/not having studio installed.

Also make sure you are linking consistently to all debug or all release libraries.

pradeepreddyg95
30th September 2012, 05:58
ASSERT failure in QVector<T>::at: "index out of range", file ..\..\include/QtCore/../../src/corelib/tools/qvector.h, line 351

In your code if your using QVector the problem is vector is not filled and you are accessing that which means
the vector size is zero . without filling vector if you access m_nvector.at(0) then "vector index out of range " it will show and program will crash ..
once again check your code if your are using Qvector in your code .

eg:


if(m_nvector.size()
m_nvector.at(0)

try this where ever you are using vector I hope this will solve your problem ....

amleto
30th September 2012, 11:18
you can see from the call stack that the QVector instance that asserts is a Qt private implementation instance so what you suggest won't help here.