QStringEncoder/Decoder: make base class ctors protected

Base class dtors should either be public and virtual or else
non-virtual and protected. We don't need polymorphy, so make them
protected.

Because ~QStringConverter is now user-declared, the move special
member functions are suppressed. Re-add them using = default.

[ChangeLog][QtCore][Potentially Source-Incompatible Changes]
[QStringEncoder/Decoder] The destructors of the base classes of
QStringEncoder and QStringDecoder are now protected, to prevent
slicing.

Change-Id: I72cc5b98af1a6533a46080b537e1900808e1f130
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2022-02-21 17:35:42 +01:00
parent d10bbc2e6a
commit a87edb9ae9

View File

@ -110,6 +110,8 @@ public:
private:
Q_DISABLE_COPY(State)
};
protected:
~QStringConverterBase() = default;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QStringConverterBase::Flags)
@ -166,8 +168,11 @@ protected:
{}
Q_CORE_EXPORT explicit QStringConverter(const char *name, Flags f) noexcept;
~QStringConverter() = default;
public:
QStringConverter(QStringConverter &&) = default;
QStringConverter &operator=(QStringConverter &&) = default;
bool isValid() const noexcept { return iface != nullptr; }