[Qt][OSX] Fix Cmd-Q / Menu Quit shutdown on OSX #8046

pull jonasschnelli wants to merge 1 commits into bitcoin:master from jonasschnelli:2016/05/fix_quit changing 1 files +1 −0
  1. jonasschnelli commented at 8:12 AM on May 12, 2016: contributor

    Most Users on OSX close applications with Cmd-Q or with "Menu"->"Quit".

    There is one inconvenience during startup of Bitcoin-Qt on OSX: If you quit the application during the splashscreen-phase, it doesn't quit the initial verification. This leads to a problem where the user needs to wait until bitcoin-qt has verified 100% of the last ~288 blocks before the application actually quits.

    This PR fixes that and enables the same behavior on OSX then we have on Linux/Windows.

  2. jonasschnelli added the label GUI on May 12, 2016
  3. jonasschnelli added the label MacOSX on May 12, 2016
  4. in src/qt/bitcoin.cpp:None in 11d2b68ce2 outdated
     366 | @@ -364,7 +367,7 @@ void BitcoinApplication::createWindow(const NetworkStyle *networkStyle)
     367 |  
     368 |  void BitcoinApplication::createSplashScreen(const NetworkStyle *networkStyle)
     369 |  {
     370 | -    SplashScreen *splash = new SplashScreen(0, networkStyle);
     371 | +    splash = new SplashScreen(0, networkStyle);
     372 |      // We don't hold a direct pointer to the splash screen after creation, so use
     373 |      // Qt::WA_DeleteOnClose to make sure that the window will be deleted eventually.
     374 |      splash->setAttribute(Qt::WA_DeleteOnClose);
    


    laanwj commented at 9:29 AM on May 12, 2016:

    You should remove this deleteonclose if you want to hold on to a pointer and/or manually delete the splash screen.

    Note that this changes the lifetime of the splash to the lifetime of the entire application instead of just while it is visible.


    jonasschnelli commented at 9:31 AM on May 12, 2016:

    Oh. Yes. Let me keep the WA_DeleteOnClose and remove the explicit deconstruction.


    laanwj commented at 9:34 AM on May 12, 2016:

    But then you're not allowed to store a pointer to it, so you can't explicitly close it in this way.

    What you can do is make the splash subscribe to a signal that hides it.


    laanwj commented at 9:34 AM on May 12, 2016:

    Eh such a signal exists: splashFinished


    jonasschnelli commented at 9:35 AM on May 12, 2016:

    Thanks! Right. I though WA_DeleteOnClose would nullify the pointer. But right, thats not possible. Let me adapt the signals approach.


    laanwj commented at 9:38 AM on May 12, 2016:

    right - a "weak pointer" (qt has one in the form of QWeakPointer) would have that behavior, but it'd be overkill here

  5. jonasschnelli force-pushed on May 12, 2016
  6. jonasschnelli force-pushed on May 12, 2016
  7. [Qt][OSX] Fix Cmd-Q / Menu Quit shutdown on OSX 34ebceb25a
  8. jonasschnelli force-pushed on May 12, 2016
  9. jonasschnelli commented at 9:44 AM on May 12, 2016: contributor

    Thanks @laanwj. The signal approach is much better and actually a one-line change.

  10. laanwj commented at 10:01 AM on May 12, 2016: member

    tested ACK (well not tested on OSX but that it breaks nothing on Ubuntu) https://github.com/bitcoin/bitcoin/pull/8046/commits/34ebceb25a40a2160349656265951cbe9a5b0f34

  11. jonasschnelli merged this on May 12, 2016
  12. jonasschnelli closed this on May 12, 2016

  13. jonasschnelli referenced this in commit 169d379c98 on May 12, 2016
  14. MarcoFalke locked this on Sep 8, 2021
Labels

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-21 18:15 UTC

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