QDBusIntrospection: make DiagnosticsReporter safe to use

Add a virtual destructor to this polymorphic class and disable copying
(requires to bring the default ctor back manually, and to export the
class nested in an exported class).

Amends 248d2103b5ef8f9cf8c1189cb67d78e1b6e741b7.

Change-Id: I9008e4ecebca34feac6ae92fa026f2673b652ba9
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 02d7c8c069b93f7ddc1ccba462d8ff9ec3c1d806)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2024-02-20 08:51:01 +01:00 committed by Qt Cherry-pick Bot
parent 368f788ba1
commit 030496750e
2 changed files with 7 additions and 1 deletions

View File

@ -21,6 +21,9 @@ QT_BEGIN_NAMESPACE
But they may prove useful if the XML data was obtained through other means (like parsing a file). But they may prove useful if the XML data was obtained through other means (like parsing a file).
*/ */
QDBusIntrospection::DiagnosticsReporter::~DiagnosticsReporter()
= default;
/*! /*!
\class QDBusIntrospection::Argument \class QDBusIntrospection::Argument
\inmodule QtDBus \inmodule QtDBus

View File

@ -58,9 +58,12 @@ public:
qint64 columnNumber = 0; qint64 columnNumber = 0;
}; };
class DiagnosticsReporter class Q_DBUS_EXPORT DiagnosticsReporter
{ {
Q_DISABLE_COPY_MOVE(DiagnosticsReporter)
public: public:
DiagnosticsReporter() = default;
virtual ~DiagnosticsReporter();
virtual void warning(const SourceLocation &location, const char *msg, ...) virtual void warning(const SourceLocation &location, const char *msg, ...)
Q_ATTRIBUTE_FORMAT_PRINTF(3, 4) = 0; Q_ATTRIBUTE_FORMAT_PRINTF(3, 4) = 0;
virtual void error(const SourceLocation &location, const char *msg, ...) virtual void error(const SourceLocation &location, const char *msg, ...)