From 877a397cac72bcad88d8510080228f27d9375e7f69c4db2816cc6cf36124408a Mon Sep 17 00:00:00 2001 From: Christophe Marin Date: Sat, 6 Apr 2024 13:15:09 +0000 Subject: [PATCH] - Add upstream change to restore binary compatibility (QTBUG-123997): * 0001-Fix-ABI-breakage-wrt-QAudioSink-Source-stateChanged-.patch OBS-URL: https://build.opensuse.org/package/show/KDE:Qt6/qt6-multimedia?expand=0&rev=42 --- ...-wrt-QAudioSink-Source-stateChanged-.patch | 267 ++++++++++++++++++ qt6-multimedia.changes | 6 + qt6-multimedia.spec | 2 + 3 files changed, 275 insertions(+) create mode 100644 0001-Fix-ABI-breakage-wrt-QAudioSink-Source-stateChanged-.patch diff --git a/0001-Fix-ABI-breakage-wrt-QAudioSink-Source-stateChanged-.patch b/0001-Fix-ABI-breakage-wrt-QAudioSink-Source-stateChanged-.patch new file mode 100644 index 0000000..ed14916 --- /dev/null +++ b/0001-Fix-ABI-breakage-wrt-QAudioSink-Source-stateChanged-.patch @@ -0,0 +1,267 @@ +From 7fcea568c9c64f3bcebda21f0df02aa0107dfd0c Mon Sep 17 00:00:00 2001 +From: Volker Hilsheimer +Date: Thu, 4 Apr 2024 15:55:10 +0200 +Subject: [PATCH] Fix ABI breakage wrt QAudioSink/Source::stateChanged signals +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Amends edaec2bf714c98d65f12c8ed9a2ffbd1603635a7, which +removed the QAudioSink/Source::stateChanged(QAudio::State) +symbols from the API, thus breaking binary compatibility to +Qt 6.6. Since moc-generated code compares pointer-to-member- +functions, we cannot bring that symbol back and still have +such connections work. + +The only reasonable way to fix this is to reverse the +namespace aliasing: QAudio is the real namespace, QtAudio +becomes an alias. All symbols are then exported with the +QAudio type in their signature, even if declared with +QtAudio types as parameters, so we don't need any removed_api +tricks to bring the old symbols back. + +We just need to trick qdoc into seeing the namespace as +QtAudio, which is trivial and has no ABI implications. The +previous caveat that string-based connections need to use +QAudio doesn't change with this. + +[ChangeLog][Binary Compatibility Note] Qt 6.7.0 broke binary +compatibility by renaming the QAudio namespace to QtAudio. +Qt 6.7.1 restores compatibility with previous Qt 6 versions +again by making QtAudio an alias for the QAudio namespace, +but breaks BC with 6.7.0. Code previously built against 6.7.0 +needs to be recompiled. + +Fixes: QTBUG-123997 +Change-Id: I456db61ff0bd1d97af7ce2d2a7968999d891a84d +Reviewed-by: Axel Spoerl +Reviewed-by: Jøger Hansegård +(cherry picked from commit 6f590d44bb186178902a5fc3dc4a12cee8e88eaa) +Reviewed-by: Qt Cherry-pick Bot +--- + src/multimedia/audio/qaudio.h | 8 +++- + src/multimedia/audio/qaudiosink.cpp | 4 +- + src/multimedia/audio/qaudiosink.h | 15 +++----- + src/multimedia/audio/qaudiosource.cpp | 4 +- + src/multimedia/audio/qaudiosource.h | 15 +++----- + src/multimedia/audio/qtaudio.cpp | 4 ++ + src/multimedia/compat/removed_api.cpp | 55 --------------------------- + 7 files changed, 26 insertions(+), 79 deletions(-) + +diff --git a/src/multimedia/audio/qaudio.h b/src/multimedia/audio/qaudio.h +index b569b3a15..5ae994b9f 100644 +--- a/src/multimedia/audio/qaudio.h ++++ b/src/multimedia/audio/qaudio.h +@@ -19,7 +19,11 @@ QT_BEGIN_NAMESPACE + // Class forward declaration required for QDoc bug + class QString; + ++#if defined(Q_QDOC) + namespace QtAudio ++#else ++namespace QAudio ++#endif + { + enum Error { NoError, OpenError, IOError, UnderrunError, FatalError }; + enum State { ActiveState, SuspendedState, StoppedState, IdleState }; +@@ -34,8 +38,8 @@ namespace QtAudio + Q_MULTIMEDIA_EXPORT float convertVolume(float volume, VolumeScale from, VolumeScale to); + } + +-#if !defined(Q_QDOC) && !QT_MULTIMEDIA_REMOVED_SINCE(6, 7) +-namespace QAudio = QtAudio; ++#if !defined(Q_QDOC) ++namespace QtAudio = QAudio; + #endif + + #ifndef QT_NO_DEBUG_STREAM +diff --git a/src/multimedia/audio/qaudiosink.cpp b/src/multimedia/audio/qaudiosink.cpp +index aac96c342..12263d32a 100644 +--- a/src/multimedia/audio/qaudiosink.cpp ++++ b/src/multimedia/audio/qaudiosink.cpp +@@ -279,7 +279,7 @@ qint64 QAudioSink::elapsedUSecs() const + /*! + Returns the error state. + */ +-QtAudio::Error QAudioSink::error(QT6_IMPL_NEW_OVERLOAD) const ++QtAudio::Error QAudioSink::error() const + { + return d ? d->error() : QAudio::OpenError; + } +@@ -287,7 +287,7 @@ QtAudio::Error QAudioSink::error(QT6_IMPL_NEW_OVERLOAD) const + /*! + Returns the state of audio processing. + */ +-QtAudio::State QAudioSink::state(QT6_IMPL_NEW_OVERLOAD) const ++QtAudio::State QAudioSink::state() const + { + return d ? d->state() : QAudio::StoppedState; + } +diff --git a/src/multimedia/audio/qaudiosink.h b/src/multimedia/audio/qaudiosink.h +index 7a4eb732a..e071e6fbc 100644 +--- a/src/multimedia/audio/qaudiosink.h ++++ b/src/multimedia/audio/qaudiosink.h +@@ -49,21 +49,18 @@ public: + qint64 processedUSecs() const; + qint64 elapsedUSecs() const; + +-#if QT_MULTIMEDIA_REMOVED_SINCE(6, 7) +- QAudio::Error error() const; +- QAudio::State state() const; +-#endif +- QtAudio::Error error(QT6_DECL_NEW_OVERLOAD) const; +- QtAudio::State state(QT6_DECL_NEW_OVERLOAD) const; ++ QtAudio::Error error() const; ++ QtAudio::State state() const; + + void setVolume(qreal); + qreal volume() const; + + Q_SIGNALS: +-#ifdef Q_MOC_RUN +- void stateChanged(QAudio::State state); +-#else ++#if defined(Q_QDOC) + void stateChanged(QtAudio::State state); ++#else ++ // use QAudio here to keep string-based connections working ++ void stateChanged(QAudio::State state); + #endif + + private: +diff --git a/src/multimedia/audio/qaudiosource.cpp b/src/multimedia/audio/qaudiosource.cpp +index 5e59a4798..1ed5e82bc 100644 +--- a/src/multimedia/audio/qaudiosource.cpp ++++ b/src/multimedia/audio/qaudiosource.cpp +@@ -340,7 +340,7 @@ qint64 QAudioSource::elapsedUSecs() const + Returns the error state. + */ + +-QtAudio::Error QAudioSource::error(QT6_IMPL_NEW_OVERLOAD) const ++QtAudio::Error QAudioSource::error() const + { + return d ? d->error() : QAudio::OpenError; + } +@@ -349,7 +349,7 @@ QtAudio::Error QAudioSource::error(QT6_IMPL_NEW_OVERLOAD) const + Returns the state of audio processing. + */ + +-QtAudio::State QAudioSource::state(QT6_IMPL_NEW_OVERLOAD) const ++QtAudio::State QAudioSource::state() const + { + return d ? d->state() : QAudio::StoppedState; + } +diff --git a/src/multimedia/audio/qaudiosource.h b/src/multimedia/audio/qaudiosource.h +index 71c5446ee..f0ad0ceb5 100644 +--- a/src/multimedia/audio/qaudiosource.h ++++ b/src/multimedia/audio/qaudiosource.h +@@ -50,18 +50,15 @@ public: + qint64 processedUSecs() const; + qint64 elapsedUSecs() const; + +-#if QT_MULTIMEDIA_REMOVED_SINCE(6, 7) +- QAudio::Error error() const; +- QAudio::State state() const; +-#endif +- QtAudio::Error error(QT6_DECL_NEW_OVERLOAD) const; +- QtAudio::State state(QT6_DECL_NEW_OVERLOAD) const; ++ QtAudio::Error error() const; ++ QtAudio::State state() const; + + Q_SIGNALS: +-#ifdef Q_MOC_RUN +- void stateChanged(QAudio::State state); +-#else ++#if defined(Q_QDOC) + void stateChanged(QtAudio::State state); ++#else ++ // use QAudio here to keep string-based connections working ++ void stateChanged(QAudio::State state); + #endif + + private: +diff --git a/src/multimedia/audio/qtaudio.cpp b/src/multimedia/audio/qtaudio.cpp +index 999248bb6..fb14e5093 100644 +--- a/src/multimedia/audio/qtaudio.cpp ++++ b/src/multimedia/audio/qtaudio.cpp +@@ -62,7 +62,11 @@ QT_BEGIN_NAMESPACE + \sa QtAudio::convertVolume() + */ + ++#if defined(Q_QDOC) + namespace QtAudio ++#else ++namespace QAudio ++#endif + { + + /*! +diff --git a/src/multimedia/compat/removed_api.cpp b/src/multimedia/compat/removed_api.cpp +index 15e92c414..567024c8e 100644 +--- a/src/multimedia/compat/removed_api.cpp ++++ b/src/multimedia/compat/removed_api.cpp +@@ -9,61 +9,6 @@ QT_USE_NAMESPACE + + #if QT_MULTIMEDIA_REMOVED_SINCE(6, 7) + +-// implement removed functions from qaudio.h +-#include +-#include +- +-namespace QAudio +-{ +- enum VolumeScale {}; +- enum Error {}; +- enum State {}; +- Q_MULTIMEDIA_EXPORT float convertVolume(float volume, QAudio::VolumeScale from, QAudio::VolumeScale to) +- { +- return QtAudio::convertVolume(volume, static_cast(from), +- static_cast(to)); +- } +-} +- +-#ifndef QT_NO_DEBUG_STREAM +-Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug dbg, QAudio::Error error) +-{ +- return dbg << static_cast(error); +-} +-Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug dbg, QAudio::State state) +-{ +- return dbg << static_cast(state); +-} +-Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug dbg, QAudio::VolumeScale role) +-{ +- return dbg << static_cast(role); +-} +-#endif +- +-#include +- +-QAudio::Error QAudioSink::error() const +-{ +- return static_cast(error(QT6_CALL_NEW_OVERLOAD)); +-} +- +-QAudio::State QAudioSink::state() const +-{ +- return static_cast(state(QT6_CALL_NEW_OVERLOAD)); +-} +- +-#include +- +-QAudio::Error QAudioSource::error() const +-{ +- return static_cast(error(QT6_CALL_NEW_OVERLOAD)); +-} +- +-QAudio::State QAudioSource::state() const +-{ +- return static_cast(state(QT6_CALL_NEW_OVERLOAD)); +-} +- + // #include "qotherheader.h" + // // implement removed functions from qotherheader.h + // order sections alphabetically +-- +2.44.0 + diff --git a/qt6-multimedia.changes b/qt6-multimedia.changes index 62e150a..cea4020 100644 --- a/qt6-multimedia.changes +++ b/qt6-multimedia.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sat Apr 6 13:14:31 UTC 2024 - Christophe Marin + +- Add upstream change to restore binary compatibility (QTBUG-123997): + * 0001-Fix-ABI-breakage-wrt-QAudioSink-Source-stateChanged-.patch + ------------------------------------------------------------------- Tue Apr 2 13:39:46 UTC 2024 - Christophe Marin diff --git a/qt6-multimedia.spec b/qt6-multimedia.spec index 4bdecb7..e198834 100644 --- a/qt6-multimedia.spec +++ b/qt6-multimedia.spec @@ -35,6 +35,8 @@ License: GPL-3.0-or-later URL: https://www.qt.io Source: https://download.qt.io/official_releases/qt/%{short_version}/%{real_version}%{tar_suffix}/submodules/%{tar_name}-%{real_version}%{tar_suffix}.tar.xz Source1: qt6-multimedia-rpmlintrc +# PATCH-FIX-UPSTREAM +Patch0: 0001-Fix-ABI-breakage-wrt-QAudioSink-Source-stateChanged-.patch BuildRequires: fdupes BuildRequires: pkgconfig BuildRequires: qt6-core-private-devel