Dakons blog

Erstellt: 4. 6. 2008, 23:39
GeƤndert: 21. 8. 2008, 11:50

Tracing Q_ASSERT()


After fregl gave a good tip how I could improve the models of KGpg I ran into some strange thing after a while. The Q_ASSERTS() in modeltest.cpp were not that hard to debug (although it took me 2 hours for 4 small fixes) but after this I ran into another one probably everyone has seen more than once:

ASSERT failure in QList<T>::at: "index out of range", file /usr/include/QtCore/qlist.h, line 393

Not particularly helpful in my minds. The bad thing is that you can attach a debugger on this, drkonqi doesn't come up and so you actually don't know more than before. Arguing on this on #kde-devel caused gkiagia to step up with a smart solution that is too useful to get lost:

static void qtMessageHandler(QtMsgType type, const char *msg)
	fprintf(stderr, "%s\n", msg);
	if (type == QtFatalMsg)
int main()