If you google for "QCoreApplicationPrivate::sendPostedEvents exception", you'll find a ton of hits, probably at least in part because this method eats exceptions thrown in event handlers (such as paint event handlers, ...). Programmers consequently don't know where the exceptions were thrown and have difficulty locating their bugs. I am looking for a workaround for this yet-another pain Qt
imposes on programmers. Here's the actual code snippet from qcoreapplication.cpp
:
#ifdef QT_NO_EXCEPTIONS
QCoreApplication::sendEvent(r, e);
#else
try {
QCoreApplication::sendEvent(r, e);
} catch (...) {
delete e;
locker.relock();
// since we were interrupted, we need another pass to make sure we clean everything up
data->canWait = false;
// uglehack: copied from below
--data->postEventList.recursion;
if (!data->postEventList.recursion && !data->canWait && data->eventDispatcher)
data->eventDispatcher->wakeUp();
throw; // rethrow
}
#endif
Way to go Qt
geniuses! Deep in the bowels of my code, an exception is thrown, but I don't know where because of this gem. A way to work around it presents itself in the above code: disable the exception support and recompile Qt
, or change the code and recompile. Even though it probably is not possible: does some other workaround to this problem under any operating system exist?
EDIT: I am using Qt4.8
.