Qt World Summit: Submit your Presentation

qFormatLogMessage and backtrace on win32 / msvc2013

  • Hej folks,

    I was just tinkering with my message handler and ran into something that I didn't expect. In my main.cpp I install my own message handler (which works fine) that also writes the log output to a file.
    When toying with various log format settings I figured "let's see what backtrace does", so I now have this:
    qSetMessagePattern(msgPrefix + msgType + "%{file}:%{function}:%{line} - %{message}%{if-warning}%{backtrace}%{endif}%{if-fatal}%{backtrace}%{endif}");

    However, now when I do a qWarning() << "Test!"; the whole program crashes with an exception due to a read access violation at 0x0 at the qFormatLogMessage() call.
    QT Bug, or did I mess something up? :)
    (if backtrace isn't supported on windows, that's fine, but then I'd expect empty output instead of a program crash)

    I'm running QT5.5.1 on windows 8.1 compiling with MSVC2013 in 32 bit mode.



  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Do you have by any change QT_FATAL_WARNINGS defined ?

    If not, can you try the same thing with the 5.6 beta ?