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

Crates: only store or activate sibling crate if it's valid #11770

Merged
merged 1 commit into from
Jul 28, 2023

Conversation

ronso0
Copy link
Member

@ronso0 ronso0 commented Jul 28, 2023

Close #11769

@ronso0 ronso0 linked an issue Jul 28, 2023 that may be closed by this pull request
Copy link
Member

@daschuer daschuer 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 fort the fix and the fast responds.
I have not tested it yet, just some comments.

@@ -877,7 +880,9 @@ void CrateFeature::slotCrateTableChanged(CrateId crateId) {
if (!activateCrate(m_crateTableModel.selectedCrate())) {
// probably last clicked crate was deleted, try to
// select the stored sibling
activateCrate(m_prevSiblingCrate);
if (m_prevSiblingCrate.isValid()) {
activateCrate(m_prevSiblingCrate);
Copy link
Member

Choose a reason for hiding this comment

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

This seems to be the fix, right?

Copy link
Member

Choose a reason for hiding this comment

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

This code is also in place at 2.3.
Does this crash happen in 2.3 as well?

@@ -862,7 +862,10 @@ void CrateFeature::storePrevSiblingCrateId(CrateId crateId) {
TreeItem* pTreeItem = m_pSidebarModel->getItem(newIndex);
DEBUG_ASSERT(pTreeItem != nullptr);
if (!pTreeItem->hasChildren()) {
m_prevSiblingCrate = crateIdFromIndex(newIndex);
CrateId prevCrateId = crateIdFromIndex(newIndex);
if (prevCrateId.isValid()) {
Copy link
Member

Choose a reason for hiding this comment

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

I did a look around and I have not yet understand in which cases it can be invalid at all? Does this case source from another bug deeper in the code? Can we have children with invalid crates? Please add a comment to the code.

Idea: The loop can be reversed and exited early with break. That would make the "search for one sibling" nature more clear.

Copy link
Member Author

Choose a reason for hiding this comment

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

True, this is excessive. The check in activateCrate() is sufficient.
I'll revert this.

@ronso0 ronso0 force-pushed the crate-delete-assert branch from db8ce6a to d98ae96 Compare July 28, 2023 11:03
@daschuer
Copy link
Member

Thank you. Is this a 2.3 PR then?
@JoergAtGithub does thit fix you issue?

@daschuer
Copy link
Member

Oh nevermind, just read you commend at the bug report.

Copy link
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

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

LGTM

@daschuer daschuer merged commit 2792dea into mixxxdj:2.4 Jul 28, 2023
@JoergAtGithub
Copy link
Member

I'm on holiday and can't test it now.

@ronso0 ronso0 deleted the crate-delete-assert branch July 28, 2023 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Debug Assert if I delete the last existing Crate
3 participants