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

Revert "utils/IXmlDeserializable: drop useless interface" #14049

Merged
merged 1 commit into from
Jun 15, 2018

Conversation

a1rwulf
Copy link
Member

@a1rwulf a1rwulf commented Jun 14, 2018

This reverts commit f821789.

@MaxKellermann this breaks the "Component Specific Loggin"-Toggle in Settings for me.
I have just bisected it and this revert fixes it, however I did not look how this commit could break it.

How Has This Been Tested?

Tested on Linux X11.

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@a1rwulf a1rwulf added Type: Fix non-breaking change which fixes an issue v18 Leia labels Jun 14, 2018
@a1rwulf a1rwulf added this to the Leia 18.0-alpha2 milestone Jun 14, 2018
@a1rwulf a1rwulf requested a review from Rechi June 14, 2018 21:16
@ksooo
Copy link
Member

ksooo commented Jun 15, 2018

class CSettingDependencyCondition : public CSettingConditionItem

both classes (did) override Deserialize.

Maybe this causes the problem? Did no deep analysis, though.

@MaxKellermann
Copy link
Contributor

Sorry for the breakage, I'll investigate.

@MaxKellermann
Copy link
Contributor

@a1rwulf this revert is correct, and my patch was wrong. But its description was correct:

There is no IXmlDeserializable::Deserialize() call on a possibly polymorphed object

That is true. The thing is that while nobody uses the IXmlDeserializable interface, CBooleanLogicOperation calls CBooleanLogicValue::Deserialize(), and CBooleanLogic calls CBooleanLogicOperation::Deserialize() - both are virtual only because the vtable was inherited from IXmlDeserializable. Even if nobody uses the interface, the Deserialize() method needs to be virtual.
I find this coding style confusing and I wouldn't design it that way; if I define an interface, I expect callers to use that interface, and not classes derived from it. Anyway, my confusion was my mistake, and this needs a revert.

Thanks for the bisect and the PR. I suggest merging it.

@ksooo ksooo merged commit c14e34d into xbmc:master Jun 15, 2018
@ksooo
Copy link
Member

ksooo commented Jun 15, 2018

I suggest merging it.

Thanks, Max. Done.

@yol
Copy link
Member

yol commented Jun 15, 2018

Shouldn't we at least add a comment to IXmlDeserializable to prevent this from happening again?

@ksooo
Copy link
Member

ksooo commented Jun 15, 2018

Shouldn't we at least add a comment to IXmlDeserializable to prevent this from happening again?

Fixing the strange design Max mentioned would even be better.

@a1rwulf
Copy link
Member Author

a1rwulf commented Jun 15, 2018

That is true. The thing is that while nobody uses the IXmlDeserializable interface, CBooleanLogicOperation calls CBooleanLogicValue::Deserialize(), and CBooleanLogic calls CBooleanLogicOperation::Deserialize() - both are virtual only because the vtable was inherited from IXmlDeserializable. Even if nobody uses the interface, the Deserialize() method needs to be virtual.
I find this coding style confusing and I wouldn't design it that way; if I define an interface, I expect callers to use that interface, and not classes derived from it. Anyway, my confusion was my mistake, and this needs a revert.

We have quite some of such places in our code and your effort to do cleanups is much appreciated.

@ksooo
Copy link
Member

ksooo commented Jun 15, 2018

and your effort to do cleanups is much appreciated.

definitely +1

@MaxKellermann
Copy link
Contributor

I'd still remove IXmlDeserializable completely in the long run, and instead add virtual Deserialize() methods to those base classes that need it. Having one central interface for it that is used by nobody directly only adds confusion and overhead.

@ksooo
Copy link
Member

ksooo commented Jun 15, 2018

I agree. If you you are in the mood to do this, you are more than welcome. :-)

@a1rwulf a1rwulf deleted the fix-settings-regression branch October 10, 2018 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Fix non-breaking change which fixes an issue v18 Leia
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants