qt: Use qInfo() if no error occurs #16263

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:20190621-qInfo changing 4 files +4 −4
  1. hebasto commented at 5:42 pm on June 21, 2019: member

    Warning and Debugging Messages:

    • qInfo() is used for informational messages.
    • qWarning() is used to report warnings and recoverable errors in your application.

    If the QT_FATAL_WARNINGS environment variable is set, qWarning() exits after printing the warning message. This makes it easy to obtain a backtrace in the debugger.

    qWarning():

    Calls the message handler with the warning message message… This function does nothing if QT_NO_WARNING_OUTPUT was defined during compilation; it exits if at the nth warning corresponding to the counter in environment variable QT_FATAL_WARNINGS.

    This PR allows more productive debugging using the environment variable QT_FATAL_WARNINGS.

    Examples:

    The behavior, when option -debug=qt is set/unset, remains unchanged.

  2. Use qInfo() if no error occurs
    qWarning() is used to report warnings and recoverable errors in your 
    application.
    qInfo() is used for informational messages (since Qt 5.5).
    a2aabfb749
  3. hebasto commented at 5:43 pm on June 21, 2019: member
    ping @promag
  4. MarcoFalke added the label Refactoring on Jun 21, 2019
  5. MarcoFalke added the label GUI on Jun 21, 2019
  6. promag commented at 5:52 pm on June 21, 2019: member
    ACK a2aabfb, I also have this change locally.
  7. fanquake approved
  8. fanquake commented at 1:51 pm on June 23, 2019: member

    ACK a2aabfb749198bce896c9e597082acd67d3b863e.

    Using master and setting QT_FATAL_WARNINGS=1, Qt bombs out at the first usage of qWarning():

    02019-06-23T10:21:21Z UpdateTip: new best=000000000000000000b6a9e3c4aa5619a48023818df48f757f8fff650b51de85 height=494994 version=0x20000002 log2_work=87.490425 tx=272517027 date='2017-11-18T23:38:38Z' progress=0.642811 cache=4.2MiB(31387txo)
    12019-06-23T10:21:21Z UpdateTip: new best=000000000000000000aa16a81a9b3b74f47f07bd6184705a3525e8325dffa54f height=494995 version=0x20000000 log2_work=87.490464 tx=272519017 date='2017-11-19T00:03:10Z' progress=0.642816 cache=5.2MiB(39744txo)
    22019-06-23T10:21:21Z UpdateTip: new best=00000000000000000076be6678a2efa7793f98900ac0490863514f291e0f90f8 height=494996 version=0x20000000 log2_work=87.490502 tx=272519980 date='2017-11-19T00:03:48Z' progress=0.642818 cache=6.1MiB(47055txo)
    32019-06-23T10:21:21Z GUI: Platform customization: "macosx"
    

    With these changes, I still saw at least one segfault (a restart without QT_FATAL_WARNINGS=1 fixed this):

     0bash-3.2$ lldb Bitcoin-Qt.app -- -regtest
     1(lldb) target create "Bitcoin-Qt.app"
     2Current executable set to 'Bitcoin-Qt.app' (x86_64).
     3(lldb) settings set -- target.run-args  "-regtest"
     4(lldb) env QT_FATAL_WARNINGS=1
     5(lldb) run
     6Process 77848 launched: '/Users/michael/github/bitcoin/Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt' (x86_64)
     72019-06-23 21:32:45.810272+0800 Bitcoin-Qt[77848:246558] MessageTracer: Falling back to default whitelist
     8Process 77848 stopped
     9* thread [#1](/bitcoin-bitcoin/1/), name = 'bitcoin-main', queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    10    frame [#0](/bitcoin-bitcoin/0/): 0x00007fff7e3be2c6 libsystem_kernel.dylib`__pthread_kill + 10
    11libsystem_kernel.dylib`__pthread_kill:
    12->  0x7fff7e3be2c6 <+10>: jae    0x7fff7e3be2d0            ; <+20>
    13    0x7fff7e3be2c8 <+12>: movq   %rax, %rdi
    14    0x7fff7e3be2cb <+15>: jmp    0x7fff7e3b8457            ; cerror_nocancel
    15    0x7fff7e3be2d0 <+20>: retq   
    16Target 0: (Bitcoin-Qt) stopped.
    

    debug.log:

    02019-06-23T13:34:33Z msghand thread start
    12019-06-23T13:34:33Z init message: Done loading
    22019-06-23T13:34:33Z GUI: Platform customization: "macosx"
    32019-06-23T13:34:33Z GUI: Window position QRect(-4,85 836x510) outside any known screen, using primary screen
    

    Note: 32 instances of qWarning() left with the bulk in paymentrequest & payment server code.

  9. fanquake requested review from jonasschnelli on Jun 23, 2019
  10. laanwj commented at 6:43 pm on June 23, 2019: member

    I think the historical reason these are not qInfo is that some older Qt versions didn’t have that. But I think that was pre-qt5. ACK a2aabfb749198bce896c9e597082acd67d3b863e

    Edit: Eh, no https://doc.qt.io/qt-5/qtglobal.html#qInfo

    This function was introduced in Qt 5.5.

    I guess that’s ok now that 5.5.1 is the minimum.

  11. fanquake merged this on Jun 24, 2019
  12. fanquake closed this on Jun 24, 2019

  13. fanquake referenced this in commit c8fee6769a on Jun 24, 2019
  14. hebasto deleted the branch on Jun 24, 2019
  15. jasonbcox referenced this in commit b0c3231175 on Nov 12, 2020
  16. Munkybooty referenced this in commit 370ec45a1f on Oct 30, 2021
  17. Munkybooty referenced this in commit 70e305e810 on Oct 30, 2021
  18. Munkybooty referenced this in commit 26401de456 on Nov 2, 2021
  19. Munkybooty referenced this in commit a3e4529a10 on Nov 2, 2021
  20. Munkybooty referenced this in commit a7f877741a on Nov 4, 2021
  21. Munkybooty referenced this in commit 8dd46b2e14 on Nov 16, 2021
  22. Munkybooty referenced this in commit b2f9eef0d5 on Nov 18, 2021
  23. MarcoFalke locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-06 16:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me