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 initalisation order #4058

Merged
merged 13 commits into from
Aug 1, 2021
Merged

Conversation

daschuer
Copy link
Member

@daschuer daschuer commented Jul 5, 2021

This fixes the untranslated menu bar https://bugs.launchpad.net/mixxx/+bug/1934655 and is a prerequisite of the untranslated help output fix.

Copy link
Contributor

@uklotzde uklotzde left a comment

Choose a reason for hiding this comment

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

Only minor comments

src/coreservices.cpp Show resolved Hide resolved
@@ -102,7 +102,8 @@ inline QLocale inputLocale() {
namespace mixxx {

CoreServices::CoreServices(const CmdlineArgs& args)
: m_runtime_timer(QLatin1String("CoreServices::runtime")),
: m_pLV2Backend(nullptr),
Copy link
Contributor

Choose a reason for hiding this comment

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

We should initialize this plain pointer in the header with LV2Backend* m_pLV2Backend{};

Copy link
Contributor

Choose a reason for hiding this comment

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

EffectsBackends don't even belong here. This is fixed in #2618. DlgPrefLV2 has been removed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please do not touch any effects code before merging #2618. I refuse to fix any merge conflicts from others doing so.

Copy link
Member Author

Choose a reason for hiding this comment

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

We should initialize this plain pointer in the header with LV2Backend* m_pLV2Backend{};

In Mixxx we only header initialization with exceptions because this introduces a hidden static constructor.
https://github.com/mixxxdj/mixxx/wiki/Coding-Guidelines#non-static-data-member-initializers

Copy link
Contributor

@uklotzde uklotzde Jul 5, 2021

Choose a reason for hiding this comment

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

I strongly disagree. It doesn't make any sense to repeat all plain pointer members and initialize them explicitly with nullptr. This introduces useless noise. It's much more safe to initialize them directly, especially if you have many of them, see WTrackMenu. By using managed pointers this issue will hopefully disappear over time.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should revise the coding guidelines. Neither do I understand the motivation nor the issue that should be solved.

Copy link
Contributor

Choose a reason for hiding this comment

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

"...is used if the member is omitted from the member initializer list of a constructor".

What's wrong with providing a sensible default value to prevent uninitialized members???

Copy link
Contributor

Choose a reason for hiding this comment

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

This whole discussion about what to do with the pointer is moot. It is removed from this code already in #2618.

Copy link
Member Author

Choose a reason for hiding this comment

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

What's wrong with providing a sensible default value to prevent uninitialized members???

Nothing.

The question is just where it should be done.
The normal or lets say legacy place is the initialization list in the constructor.
If we keep this habit we have a single place to look at.

Here we have the case where some variables are const initialized and some from parameter values. So you need to look at two places. The header initialization causes an extra static inline constructor and forces recompile more files if we change that value.

The solution in WTrackMenu initializes many pointers twice. One time the stat inline constructor and one time in the real constructor. This is IMHO even more an issue, because the reader might think that he has to deal with a null pointer when he looks into the header which is not the case.

I am not opposing to adjust our policy if we have sensible new ideas. But for now I like to keep the current solution here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to choose the header-only modification for minimizing the amount of changes and potential merge conflicts. In the end it doesn't matter, so let's be pragmatic.

Copy link
Contributor

@Be-ing Be-ing left a comment

Choose a reason for hiding this comment

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

merge #2618 first

@daschuer
Copy link
Member Author

daschuer commented Jul 5, 2021

merge #2618 first

@Be-ing:

We have no policy to reject a PR, because it causes conflicts in other PRs. #2618 is not yet mature, so there is anyway something to do left. I am preparing a post, but because of the giant size it will take a while. If this introduces a merge conflicts, it will be trivial to solve, so this should be not a blocking issue for this PR.

@uklotzde:
What do you think? Just merge, or should I do the hassle of re-basing it out and seeing my IDE complaining longer because of @Be-ing concerns?

@Be-ing
Copy link
Contributor

Be-ing commented Jul 5, 2021

Just merge

Yes, just merge #2618, then please go ahead and rebase this.

@Be-ing
Copy link
Contributor

Be-ing commented Jul 5, 2021

I consider actively interfering with others' work while simultaneously being the only one demanding their work be held up to be hostile.

@uklotzde
Copy link
Contributor

uklotzde commented Jul 5, 2021

@Be-ing I don't expect any major merge conflicts. Otherwise I see myself unable to continue reviewing PRs or taking part in discussions to find a solution.

@Holzhaus
Copy link
Member

Holzhaus commented Jul 6, 2021

I consider actively interfering with others' work while simultaneously being the only one demanding their work be held up to be hostile.

Daniel pointed out issues, but he's not "the only one demanding to your work to be held up". Don't make this personal. I doubt @daschuer is the only one that that has reservations about #2618 without resolving these issues or at least mentioning them in a TODO.

Anyway, I think it is of course possible to ask people nicely if they'd be willing to postpone their work to not cause merge conflicts in other PRs. But in general, it's the responsibility of the contributor to resolve merge conflicts if they arise.

Of course, huge PRs tend to stay open longer and simultaneously cause more merge conflicts. The only way to avoid this is to avoid huge PRs.

I agree with @uklotzde that the changes in this PR should should only cause trivial merge conflcits (if at all).

@Be-ing
Copy link
Contributor

Be-ing commented Jul 6, 2021

it's the responsibility of the contributor to resolve merge conflicts if they arise.

This is unhelpful.

@Be-ing
Copy link
Contributor

Be-ing commented Jul 6, 2021

Daniel pointed out issues, but he's not "the only one demanding to your work to be held up". Don't make this personal. I doubt @daschuer is the only one that that has reservations about #2618 without resolving these issues or at least mentioning them in a TODO.

This is also unhelpful. If you have objections, say them.

@Be-ing
Copy link
Contributor

Be-ing commented Jul 6, 2021

Don't make this personal.

There is an elephant in the room here. I cannot help but observe that I am treated differently. My objections to PRs get ignored (and I am not just talking about this PR, here are a few examples: #1064, #3074, mixxxdj/website#217), meanwhile @daschuer is allowed to indefinitely hold up PRs (for months at a time!) without any specific objections and hold up release blocking issues for months against the unanimous consensus of everyone else (remember the cue color debacle?). You all have let @daschuer hold up my PRs for weeks for nonsense as trivial as a code comment (#2920). I wish that was an exaggeration, but it's not, that literally happened. This is not fair and I'm not going to take it any longer. I will not keep participating in Mixxx if this is allowed to continue. There must be unbiased rules to prevent this or it will not be worth my time.

@Be-ing
Copy link
Contributor

Be-ing commented Jul 6, 2021

he's not "the only one demanding to your work to be held up"

@Holzhaus you approved #2618 months ago. If you have new objections, then explain them.

@Holzhaus
Copy link
Member

Holzhaus commented Jul 6, 2021

he's not "the only one demanding to your work to be held up"

@Holzhaus you approved #2618 months ago. If you have new objections, then explain them.

Yes, I did approve months ago. Then @daschuer spent his free time to do an in-depth review and found issues that I overlooked. While you were away, I did spent some time towards fixing them. Not because I want Daniel to shut up, but because I agreed with him.

I think it's likely that not all remaining comments are merge blockers, but this should be discussed openly and then we agree what is in scope for this PR and what is not. If you believe the discussion drags on and goes in circles, it's possible to call for a vote. But unilaterally resolving review comments without pushing a fix is not how we want or should do reviews.

@JoergAtGithub
Copy link
Member

Such discussions in PR comment sections, or Zulip, are neither productive nor does anybody feels good in the aftermath. I'm sure, that every single person here works hard to bring this project forward. But these discussions here result in excatly the opposite!
May I recommend, that you do a video conference with all the core devs. Maybe you can aggree on an conciliator, who decides about the next steps in case of conflicting opinions? Or you define a formal process (like a ballot) in case of conflicting views of different devs?

@daschuer
Copy link
Member Author

daschuer commented Jul 6, 2021

Thank you.

@Be-ing
Copy link
Contributor

Be-ing commented Jul 6, 2021

@daschuer spent his free time to do an in-depth review

This was unwanted. I specifically asked @daschuer not to do this and he refused.

If you believe the discussion drags on

It has been at that point for a long time.

unilaterally resolving review comments without pushing a fix is not how we want or should do reviews.

I have pushed over 100 commits in response to unwanted reviews.

@ywwg
Copy link
Member

ywwg commented Jul 7, 2021

Unwanted reviews? If you ask that other developers take the time to review your branch and someone does, it's not appropriate to object when they make comments and ask for changes. It is also extremely inappropriate to refuse to participate on other code reviews until your demands are met. I think we'd all like to find a way forward on 2618 but that will take working together.

@Be-ing
Copy link
Contributor

Be-ing commented Jul 7, 2021

Yes, demanding that everybody else wait indefinite amounts of time because you say you want to review despite 3 other reviewers already approving is not fair at all. And now I am being demanded to wait some indefinite amount of time for some unspecified objection to merging, yet @daschuer has found time to actively interfere with merging #2618 by making this PR.

@Be-ing
Copy link
Contributor

Be-ing commented Jul 7, 2021

It is also extremely inappropriate to refuse to participate on other code reviews until your demands are met.

When the reviewer has a history of incredibly insensitive demands on my code, such as holding up my work for weeks for a disagreement about a code comment, yeah, I don't want the review. I've been putting up with this for years, it's not okay, and it's not okay that everyone else tolerates it.

@Be-ing
Copy link
Contributor

Be-ing commented Jul 7, 2021

I have offered repeatedly to compromise by continuing to work with @daschuer on addressing remaining issues after merging #2618 to main, but he has ignored these offers and instead demanded that I continue to wait months, meanwhile merge conflicts pile up, and he does nothing to fix them, and everyone else keeps blaming me for how big the PR is while I did almost all the work for macOS (4 straight months of it!) to get 2.3 released.

@Be-ing
Copy link
Contributor

Be-ing commented Jul 7, 2021

Or you define a formal process (like a ballot) in case of conflicting views of different devs?

I have repeatedly put forth proposals for formal processes on Zulip and they have been largely ignored.

@Be-ing
Copy link
Contributor

Be-ing commented Jul 7, 2021

This endless obstruction was not tolerated in 2014 with #180, so I do not understand why it is now.

@Holzhaus
Copy link
Member

Holzhaus commented Jul 8, 2021

There are merge conflicts now.

@daschuer
Copy link
Member Author

daschuer commented Jul 8, 2021

Oh no ... fixed

@daschuer
Copy link
Member Author

daschuer commented Jul 8, 2021

ready

Copy link
Contributor

@uklotzde uklotzde left a comment

Choose a reason for hiding this comment

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

Thank you for considering our recommendations in this special case!

@uklotzde
Copy link
Contributor

uklotzde commented Jul 8, 2021

@daschuer pre-commit issues?

@daschuer
Copy link
Member Author

daschuer commented Jul 8, 2021

A white space issue. Force pushed.

@uklotzde
Copy link
Contributor

@Be-ing Ping. I would like to get consent by everyone involved.

@Holzhaus Holzhaus requested a review from Be-ing July 13, 2021 07:57
@@ -136,6 +132,25 @@ void CoreServices::initialize(QApplication* pApp) {
m_cmdlineArgs.getLogLevel(),
m_cmdlineArgs.getLogFlushLevel(),
logFlags);
}

void CoreServices::preInitialize(QApplication* pApp) {
Copy link
Member

Choose a reason for hiding this comment

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

Is this method really necessary? Couldn't we just make it part of the CoreServices constructor?

Copy link
Member

Choose a reason for hiding this comment

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

Is there any need to create the CoreServices object before creating a QApplication? If not, we should move this into the constructor. Less possibilities to use this class wrong or miss an initialization step.

Copy link
Member

Choose a reason for hiding this comment

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

Ping

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

Choose a reason for hiding this comment

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

There does not seem to be a purpose for this method. Move the code directly into the constructor.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is just documentation support.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this makes the code more readable; it makes me wonder why the function exists. I think it would be better to move the code into the constructor and add a comment: "These need to be initialized before the GUI. They are fast to initialize. Everything else is deferred to the initialize method so the GUI can show the progress."

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 like the current state.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't to bike-shed, but

  • it only contains the body of the constructor, which now contains just this single invocation and
  • the method is public although it doesn't need to be.

Copy link
Member Author

Choose a reason for hiding this comment

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

The function is private.

src/coreservices.h Outdated Show resolved Hide resolved
src/mixxxmainwindow.cpp Outdated Show resolved Hide resolved
@daschuer
Copy link
Member Author

Done!
@Be-ing: merge

@coveralls
Copy link

coveralls commented Jul 25, 2021

Pull Request Test Coverage Report for Build 1084024096

  • 0 of 18 (0.0%) changed or added relevant lines in 1 file are covered.
  • 11 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.01%) to 26.018%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/coreservices.cpp 0 18 0.0%
Files with Coverage Reduction New Missed Lines %
src/engine/readaheadmanager.cpp 2 88.79%
src/engine/cachingreader/cachingreader.cpp 9 71.38%
Totals Coverage Status
Change from base Build 1083902170: -0.01%
Covered Lines: 20004
Relevant Lines: 76886

💛 - Coveralls

@ronso0
Copy link
Member

ronso0 commented Jul 25, 2021

@Be-ing Ping. I would like to get consent by everyone involved.

FWIW in german there's a distinction between
'Konsens' (consensus) = everyone involved must agree
'Konsent' (?) = one or more minor objections are considered, but the majority decisions is implemented while the cause for the objections will be resolved asap (fear of merge conflicts)

@uklotzde
Copy link
Contributor

I have chosen the word consent deliberately.

See also: https://en.wikipedia.org/wiki/Disagree_and_commit

@ywwg
Copy link
Member

ywwg commented Jul 26, 2021

In English:

  • "consensus": has multiple meanings, but implies a majority of stakeholders agree. Does not require 100% buy-in.
  • "everyone's consent": everyone must agree

"Consensus" is a complex term because there are specific systems called "Consensus Process" which have lots of details about decision-making. But in a general sense, it means "most people agree even if some have reservations, but nobody is dead-set against the idea"

@daschuer
Copy link
Member Author

Conflicts are resolved now. Ready for merge! ?

Comment on lines 127 to 133
LV2Backend* m_pLV2Backend;
LV2Backend* m_pLV2Backend{};
Copy link
Contributor

Choose a reason for hiding this comment

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

unrelated change, please remove from this PR

@daschuer
Copy link
Member Author

Done.

@Be-ing Be-ing requested a review from Holzhaus July 31, 2021 22:36
@daschuer
Copy link
Member Author

daschuer commented Aug 1, 2021

OK, again done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants