PDA

View Full Version : MSVC 2010 and Qt 4.7.3 handling of assert()'s on custom GL windows problem



VS2k10_qt
13th June 2011, 08:43
We are using Qt with VS 2010 (latest SP available), and the current issue is, when a assert() is hit, it causes weird behavior from Qt.

Normally, when a assert() is hit, you get the standard assert dialog popup from MSVC's debugger.
Well, now, instead of getting that standard assert dialog popup, after Qt is init, and shows no errors, it goes into Qt's paint routine to try to do something, and crashes in our custom draw routines, since (in this case) we haven't even set those up yet.

assert(0); //works as it should (standard assert dialog shows)
{init Qt's GL context}
assert(0); //fails, and crashes in our routines. (no standard assert dialog is ever shown)



Warzone2100-Dbg.exe!WzMainWindow::paintGL() Line 274 C++
QtOpenGLd4.dll!QGLWidget::glDraw() Line 4484 C++
QtOpenGLd4.dll!QGLWidget::updateGL() Line 4030 C++
Warzone2100-Dbg.exe!WzMainWindow::tick() Line 120 + 0x12 bytes C++
Warzone2100-Dbg.exe!WzMainWindow::qt_metacall(QMetaObject::Cal l _c, int _id, void * * _a) Line 72 + 0x8 bytes C++
QtCored4.dll!QMetaObject::metacall(QObject * object, QMetaObject::Call cl, int idx, void * * argv) Line 238 C++
QtCored4.dll!QMetaObject::activate(QObject * sender, const QMetaObject * m, int local_signal_index, void * * argv) Line 3278 + 0x27 bytes C++
QtCored4.dll!QTimer::timeout() Line 128 + 0x12 bytes C++
QtCored4.dll!QTimer::timerEvent(QTimerEvent * e) Line 273 C++
QtCored4.dll!QObject::event(QEvent * e) Line 1182 C++
QtGuid4.dll!QApplicationPrivate::notify_helper(QOb ject * receiver, QEvent * e) Line 4462 + 0x11 bytes C++
QtGuid4.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 3862 + 0x10 bytes C++
QtCored4.dll!QCoreApplication::notifyInternal(QObj ect * receiver, QEvent * event) Line 731 + 0x15 bytes C++
QtCored4.dll!QCoreApplication::sendEvent(QObject * receiver, QEvent * event) Line 215 + 0x39 bytes C++
QtCored4.dll!QEventDispatcherWin32::event(QEvent * e) Line 1139 + 0x10 bytes C++
QtGuid4.dll!QApplicationPrivate::notify_helper(QOb ject * receiver, QEvent * e) Line 4462 + 0x11 bytes C++
QtGuid4.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 3862 + 0x10 bytes C++
QtCored4.dll!QCoreApplication::notifyInternal(QObj ect * receiver, QEvent * event) Line 731 + 0x15 bytes C++
QtCored4.dll!QCoreApplication::sendEvent(QObject * receiver, QEvent * event) Line 215 + 0x39 bytes C++
QtCored4.dll!QCoreApplicationPrivate::sendPostedEv ents(QObject * receiver, int event_type, QThreadData * data) Line 1372 + 0xd bytes C++
QtCored4.dll!qt_internal_proc(HWND__ * hwnd, unsigned int message, unsigned int wp, long lp) Line 497 + 0x10 bytes C++
...
msvcr100d.dll!__crtMessageBoxW(const wchar_t * lpText, const wchar_t * lpCaption, unsigned int uType) Line 158 + 0x13 bytes C
msvcr100d.dll!_wassert(const wchar_t * expr, const wchar_t * filename, unsigned int lineno) Line 308 + 0x16 bytes C


Anyone have any clue on why Qt appears to be hijacking the normal crtMessageBoxW() call, perhaps via its own handler routines ?
This is highly strange behavior.

Qt 4.7.3 was compiled for VS2010 as well.

Any ideas on what is going on ?

VS2k10_qt
14th June 2011, 04:46
It looks like the reason for this was, that we have a timer function that calls updateGL(), which in turn calls paintGL(), and when the assert hits, the timer is still calling updateGL().

Ugh. I really hate these kind of bugs.