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

Fix CoreServices shutdown responsibility and fix lp1912129 #4213

Merged
merged 3 commits into from
Aug 17, 2021

Conversation

Holzhaus
Copy link
Member

Please see the commit messages for details.

Fixes https://bugs.launchpad.net/mixxx/+bug/1912129.

@Holzhaus Holzhaus added minor bug code quality changelog This PR should be included in the changelog labels Aug 16, 2021
@coveralls
Copy link

coveralls commented Aug 16, 2021

Pull Request Test Coverage Report for Build 1139452486

  • 0 of 34 (0.0%) changed or added relevant lines in 1 file are covered.
  • 4 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.003%) to 25.962%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/coreservices.cpp 0 34 0.0%
Files with Coverage Reduction New Missed Lines %
src/coreservices.cpp 4 0%
Totals Coverage Status
Change from base Build 1139376155: -0.003%
Covered Lines: 19997
Relevant Lines: 77023

💛 - Coveralls

return;
}

shutdown();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about removing the shutdown function and moving its implementation to the destructor?

Copy link
Contributor

@uklotzde uklotzde Aug 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, maybe we could keep both methods separate, because the belong to each other. One does the set up and its sibling the tear down. How about renaming them to initialize() and finalize() to emphasize this relationship?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the method. Originally I wanted to keep it to keep the line count small.

This leaves less room for wrong usage (like calling `shutdown()` when it
was never initialized or forgetting to call `shutdown()` at all).

Also, `MixxxMainWindow` should not be responsible for shutting down
`CoreServices`, which is also solved here.
Fixes [lp1912129].

This gets rid of an issue where Mixxx failed with an assertion during
shutdown that complained about leaked controls (that are owned by the
menu bar):

    warning [Main] The following 6 controls were leaked:
    warning [Main] "[VinylControl]" "show_vinylcontrol" QObject(0x0)
    warning [Main] "[Master]" "skin_settings" QObject(0x0)
    warning [Main] "[PreviewDeck]" "show_previewdeck" QObject(0x0)
    warning [Main] "[Master]" "maximize_library" QObject(0x0)
    warning [Main] "[Library]" "show_coverart" QObject(0x0)
    warning [Main] "[Microphone]" "show_microphone" QObject(0x0)
    DEBUG ASSERT: "!"Controls were leaked!"" in function void mixxx::CoreServices::shutdown() at /home/jan/Projects/mixxx/src/coreservices.cpp:582
    Aborted (core dumped)

The issue occurs when shutting down Mixxx by pressing <Super>+q in Pop!
Shell which closes the window immediately. Apparently this is
incomaptible with our `sendPostedEvents()` trick to destroy the menubar
and leads to `CoreServices` being shut down before the Menubar is
actually destroyed, leaving some COs intact and triggering the
assertion.

This fixes the issue by ensuring that `MixxxMainWindow` is always
completely destroyed before `CoreServices::shutdown()` is called.

[lp1912129]: https://bugs.launchpad.net/mixxx/+bug/1912129
src/coreservices.h Outdated Show resolved Hide resolved
qDebug() << t.elapsed(false).debugMillisWithUnit() << "deleting SettingsManager";
m_pSettingsManager.reset();

CLEAR_AND_CHECK_DELETED(m_pKeyboardEventFilter);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and below is initialized in the C-Tor and skipped if initialize() has not been called.
Maybe it was a good idea to implement a counter part to initialize() to make this obvious.

@daschuer daschuer merged commit fd79c05 into mixxxdj:main Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog This PR should be included in the changelog code quality minor bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants