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

Gracefully handle outdated effect IDs #4691

Merged
merged 2 commits into from
Mar 7, 2022

Conversation

daschuer
Copy link
Member

@daschuer daschuer commented Feb 28, 2022

This happens when the user uninstalls LV2 effects and may also happen after a downgrade from a Mixxx version that includes new effects.

VERIFY_OR_DEBUG_ASSERT(m_registeredEffects.contains(effectId)) {
return EffectManifestPointer();
}
// This may return a null pointer in case a previously stored effect is no longer available
Copy link
Contributor

Choose a reason for hiding this comment

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

Please move this to a /// documentation comment in the header so this information is easier to find for the caller.

}

EffectManifestPointer EffectsBackendManager::getManifest(
const QString& id, EffectBackendType backendType) const {
return m_effectsBackends.value(backendType)->getManifest(id);
auto pEffectsBackend = m_effectsBackends.value(backendType);
VERIFY_OR_DEBUG_ASSERT(pEffectsBackend) {
Copy link
Member

Choose a reason for hiding this comment

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

is a debug assert correct? What if the user uninstalls a plugin between launches of mixxx? I think silently ignoring the bad plugin is fine, no need to assert. (Unless I'm wrong about what this code does)

Copy link
Member Author

Choose a reason for hiding this comment

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

This asserts for an backend enum that is not in the list if backends.
This should never happen, because old Mixxx versions without a new backend will not even have an enum value for it.

Copy link
Member Author

Choose a reason for hiding this comment

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

All future backbends will default to "Built-In" here:

EffectBackendType EffectsBackend::backendTypeFromString(const QString& typeName) {

There is an not documented side effect, when future backend has the same effect as the build in. In this case, instead of removing the new effect from the preset, it will be replaced by the build in type of the same name.

Is this desired or a bug?

@@ -16,6 +16,8 @@ class EffectsBackendManager {
};
const QList<EffectManifestPointer> getManifestsForBackend(EffectBackendType backendType) const;
EffectManifestPointer getManifestFromUniqueId(const QString& uid) const;
/// returns a pointer to the manifest or a null pointer in case a
/// the previously stored backend or effect is no longer available
Copy link
Member

Choose a reason for hiding this comment

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

yes, based on this documentation I think just returning nullptr is fine, it shouldn't be a debug assert.

Copy link
Member

@ywwg ywwg left a comment

Choose a reason for hiding this comment

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

There are a bunch of cases where you are using VERIFY_OR_DEBUG_ASSERTs that should perhaps just be regular conditionals. Can you please determine which cases should really never happen, and which might happen if the effects change on disk?

@Holzhaus
Copy link
Member

Holzhaus commented Mar 2, 2022

When in doubt, we should assert. At least we notice it if the assertion is wrong, rather than the other way around.

@daschuer
Copy link
Member Author

daschuer commented Mar 2, 2022

I have used asserts for conditions that are impossible as far as I understand the code.
Are there still location where my assumption is wrong? At least I can now install and uninstall LV2 effects without trigger assetions, the main goal of this PR.

@ywwg
Copy link
Member

ywwg commented Mar 3, 2022

When in doubt, we should assert. At least we notice it if the assertion is wrong, rather than the other way around.

I am talking about the case where a user was using an external effect in mixxx, and then uninstalls the effect. Mixxx shouldn't asset, it should be able to gracefully handle the missing effect.

It sounds like you've covered the uninstallation case, so we're all good here 👍

@ywwg ywwg merged commit 067971f into mixxxdj:main Mar 7, 2022
@daschuer daschuer deleted the outdated_effect_ids branch May 4, 2022 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants