Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS, do not process actions during shutdown #751

Merged
merged 2 commits into from
Oct 3, 2023

Commits on Sep 8, 2023

  1. gui: macOS, do not process dock icon actions during shutdown

    As the 'QMenuBar' is created without a parent window in MacOS, the
    app crashes when the user presses the shutdown button and, right
    after it, triggers any action in the menu bar.
    
    This happens because the QMenuBar is manually deleted in the
    BitcoinGUI destructor but the events attached to it children
    actions are not disconnected, so QActions events such us the
    'QMenu::aboutToShow' could try to access null pointers.
    
    Instead of guarding every single QAction pointer inside the
    QMenu::aboutToShow slot, or manually disconnecting all
    registered events in the destructor, we can check if a
    shutdown was requested and discard the event.
    
    The 'node' field is a ref whose memory is held by the
    main application class, so it is safe to use here. Events
    are disconnected prior destructing the main application object.
    
    Furthermore, the 'MacDockIconHandler::dockIconClicked' signal
    can make the app crash during shutdown for the very same
    reason. The 'show()' call triggers the 'QApplication::focusWindowChanged'
    event, which is connected to the 'minimize_action' QAction,
    which is also part of the app menu bar, which could no longer exist.
    furszy committed Sep 8, 2023
    Configuration menu
    Copy the full SHA
    e14cc8f View commit details
    Browse the repository at this point in the history

Commits on Sep 12, 2023

  1. gui: macOS, make appMenuBar part of the main app window

    By moving the appMenuBar destruction responsibility to the QT
    framework, we ensure the disconnection of the submenus signals
    prior to the destruction of the main app window.
    
    The standalone menu bar may have served a purpose in earlier
    versions when it didn't contain actions that directly open
    specific screens within the main application window. However,
    at present, all the actions within the appMenuBar lead to the
    opening of screens within the main app window. So, the absence
    of a main app window makes these actions essentially pointless.
    furszy committed Sep 12, 2023
    Configuration menu
    Copy the full SHA
    bae209e View commit details
    Browse the repository at this point in the history