qFatal behaviour: CrashReporter dialog without the given diagnostic output
Michael Dickens
michaelld at macports.org
Thu Mar 13 07:37:58 PDT 2014
Hi René - This is sort of an off-MacPorts topic, but it's worth
answering, too. Qt4 in MacPorts (qt4-mac) does not change the
functionality of qFatal, nor any of the other logging / message
routines. You should see the same functionality for these routines no
matter if using the pre-compiled binary or that installed by MacPorts.
According to the Qt4 docs: "qFatal() is used for writing fatal error
messages shortly before exiting."
If you look at the code, found in "src/corelib/global/qglobal.cpp" from
the top-level directory in the archive, you'll see that Qt tries really
hard to print out the message before exiting, but that under certain
conditions the message might not be printed. On the Mac, for example, if
not using a GUI ("mac_default_handler()") then fprintf is used but it is
not followed up by fflush and hence the message is not guaranteed to be
printed before the "exit()" is called.
Thus, yes, it is possible for qFatal to not print the message before
exiting. Hope this helps! - MLD
On Thu, Mar 13, 2014, at 08:36 AM, René J.V. Bertin wrote:
> Is it normal with qt4-mac, when code calls qFatal, that the running app
> is aborted without attempting to print the message passed to qFatal?
>
> I first thought it might have been related to building the qt4-mac+openvg
> variant myself, but even after installing the binary package I keep
> getting the CrashReporter dialogs without the supposedly explicative
> message.
>
> R.
>
> Thread 0 Crashed: Dispatch queue: com.apple.main-thread
> 0 libSystem.B.dylib 0x00007fff85f470b6 __kill + 10
> 1 libSystem.B.dylib 0x00007fff85fe79f6 abort + 83
> 2 QtCore 0x0000000101054925
> qt_message_output(QtMsgType, char const*) + 117
> 3 QtCore 0x0000000101054b07
> qt_message(QtMsgType, char const*, __va_list_tag*) + 183
> 4 QtCore 0x0000000101054cca qFatal(char
> const*, ...) + 170
More information about the macports-users
mailing list