[Qt] catch Windows shutdown events while client is running #4043

pull Diapolo wants to merge 1 commits into bitcoin:master from Diapolo:shutdown_win changing 4 files +111 −3
  1. Diapolo commented at 6:23 AM on April 10, 2014: none
    • prevents unsafe shutdowns on Windows, which is known to be able to cause problems with wallet.dat
    • if a users ends a Windows session, this will initiate a client shutdown and show a Windows dialog, that tells the user what is going on (for Windows Vista and higher it will even show a reason for blocking the Windows session end)

    Limitations:

    • needs Qt5 and just covers Windows

    Fixes #4036 at least for Qt and Windows.

  2. in src/qt/bitcoingui.h:None in a5bcc2f7ec outdated
      56 | @@ -57,6 +57,9 @@ class BitcoinGUI : public QMainWindow
      57 |      void removeAllWallets();
      58 |  #endif
      59 |  
      60 | +    /** Register the reason for blocking shutdown on Windows to allow clean client exit */
      61 | +    void registerShutdownBlockReason(const QString& strReason);
    


    laanwj commented at 6:29 AM on April 10, 2014:

    As this is windows shutdown specific, let's move this function to winshutdownmonitor.cpp instead.


    Diapolo commented at 9:45 AM on April 10, 2014:

    Indeed a good idea. Also I need to find the best place to call registerShutdownBlockReason() as I seem to have lost that call after you reworked the startup to be an own thread ^^. Before I was using this for months, but didn't have time to create a pull for testing and comments.

  3. Diapolo commented at 1:55 PM on April 10, 2014: none

    @laanwj What does this mean?

    <pre> i586-mingw32msvc-g++: unrecognized option '-pthread' In file included from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/windows.h:50, from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/winsock2.h:22, from ../../src/compat.h:25, from ../../src/util.h:13, from ../../src/script.h:11, from ../../src/base58.h:21, from paymentrequestplus.h:10, from paymentserver.h:34, from bitcoin.cpp:20: /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/winbase.h:1142: error: ‘PVECTORED_EXCEPTION_HANDLER’ has not been declared /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/winbase.h:1652: error: ‘HEAP_INFORMATION_CLASS’ has not been declared /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/winbase.h:1656: error: ‘HEAP_INFORMATION_CLASS’ has not been declared </pre>

  4. laanwj commented at 2:23 PM on April 10, 2014: member

    A missing library?

    The unrecognized option is harmless and probably unrelated.

  5. laanwj added this to the milestone 0.9.2 on Apr 11, 2014
  6. laanwj commented at 8:53 AM on April 11, 2014: member

    The code changes look good to me.

  7. [Qt] catch Windows shutdown events while client is running
    - prevents unsafe shutdowns on Windows, which is known to be
      able to cause problems with wallet.dat
    - if a users ends a Windows session, this will initiate a client shutdown
      and show a Windows dialog, that tells the user what is going on (for
      Windows Vista and higher it will even show a reason for blocking the
      Windows session end)
    d282c1fb64
  8. BitcoinPullTester commented at 10:21 AM on April 15, 2014: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/d282c1fb64ae570caab951247e6ead4b9059043d for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  9. laanwj commented at 3:14 PM on April 27, 2014: member

    @diapolo Is this ready for merging? (the opening post still says this is only a preview)

  10. Diapolo commented at 4:19 PM on April 27, 2014: none

    It is final, and I did test it on Win7 and Win8.1. If you would like to get more feedback, we need testers here. You checked the code and it looks good, yes?

  11. laanwj merged this on Apr 27, 2014
  12. laanwj closed this on Apr 27, 2014

  13. laanwj referenced this in commit c63b2e25a5 on Apr 27, 2014
  14. laanwj commented at 4:22 PM on April 27, 2014: member

    @Diapolo Ok, just asking, I was just about to merge this and then I saw the 'do not merge' warning.

  15. Diapolo deleted the branch on May 2, 2014
  16. DrahtBot locked this on Sep 8, 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: 2026-04-14 21:15 UTC

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