Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package qt6-webchannel for openSUSE:Factory 
checked in at 2026-11-30 14:24:16
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/qt6-webchannel (Old)
 and      /work/SRC/openSUSE:Factory/.qt6-webchannel.new.1340718 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "qt6-webchannel"

Mon Nov 30 14:24:16 2026 rev:39 rq:1400933 version:6.12.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/qt6-webchannel/qt6-webchannel.changes    
2026-10-18 19:22:01.838543029 +0200
+++ 
/work/SRC/openSUSE:Factory/.qt6-webchannel.new.1340718/qt6-webchannel.changes   
    2026-11-30 14:25:12.071900500 +0100
@@ -1,0 +2,6 @@
+Tue Nov 24 13:38:02 UTC 2026 - Christophe Marin <[email protected]>
+
+- Update to 6.12.1
+  https://www.qt.io/blog/qt-6.12.1-released
+
+-------------------------------------------------------------------

Old:
----
  qtwebchannel-everywhere-src-6.12.0.tar.xz

New:
----
  qtwebchannel-everywhere-src-6.12.1.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ qt6-webchannel.spec ++++++
--- /var/tmp/diff_new_pack.WogwR3/_old  2026-11-30 14:25:13.579964103 +0100
+++ /var/tmp/diff_new_pack.WogwR3/_new  2026-11-30 14:25:13.581964187 +0100
@@ -16,7 +16,7 @@
 #
 
 
-%define real_version 6.12.0
+%define real_version 6.12.1
 %define short_version 6.12
 %define tar_name qtwebchannel-everywhere-src
 %define tar_suffix %{nil}
@@ -27,7 +27,7 @@
 %endif
 #
 Name:           qt6-webchannel%{?pkg_suffix}
-Version:        6.12.0
+Version:        6.12.1
 Release:        0
 Summary:        Qt 6 WebChannel library
 License:        GPL-2.0-only OR LGPL-3.0-only OR GPL-3.0-only

++++++ qtwebchannel-everywhere-src-6.12.0.tar.xz -> 
qtwebchannel-everywhere-src-6.12.1.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.12.0/.cmake.conf 
new/qtwebchannel-everywhere-src-6.12.1/.cmake.conf
--- old/qtwebchannel-everywhere-src-6.12.0/.cmake.conf  2026-09-27 
12:11:37.000000000 +0200
+++ new/qtwebchannel-everywhere-src-6.12.1/.cmake.conf  2026-11-16 
23:08:55.000000000 +0100
@@ -1,4 +1,4 @@
-set(QT_REPO_MODULE_VERSION "6.12.0")
+set(QT_REPO_MODULE_VERSION "6.12.1")
 set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1")
 set(QT_EXTRA_INTERNAL_TARGET_DEFINES
     "QT_NO_DISCONNECT_CONST_CONNECTION=1"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.12.0/.tag 
new/qtwebchannel-everywhere-src-6.12.1/.tag
--- old/qtwebchannel-everywhere-src-6.12.0/.tag 2026-09-27 12:11:37.000000000 
+0200
+++ new/qtwebchannel-everywhere-src-6.12.1/.tag 2026-11-16 23:08:55.000000000 
+0100
@@ -1 +1 @@
-621cb3df07d6cf316dd026ec71311368adfe371e
+6439e335f47fea1599bde3a3e883304669fa80d6
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/qtwebchannel-everywhere-src-6.12.0/coin/axivion/ci_config_linux.json 
new/qtwebchannel-everywhere-src-6.12.1/coin/axivion/ci_config_linux.json
--- old/qtwebchannel-everywhere-src-6.12.0/coin/axivion/ci_config_linux.json    
2026-09-27 12:11:37.000000000 +0200
+++ new/qtwebchannel-everywhere-src-6.12.1/coin/axivion/ci_config_linux.json    
2026-11-16 23:08:55.000000000 +0100
@@ -25,7 +25,7 @@
             "_copy_from": "AxivionLinker",
             "input_files": [
                 "build/lib/lib*.so*.ir",
-                "build/qml/*/lib*.so*.ir"
+                "build/qml/**/lib*.so*.ir"
             ],
             "ir": "build/$(env:TESTED_MODULE_COIN).ir"
         }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.12.0/dependencies.yaml 
new/qtwebchannel-everywhere-src-6.12.1/dependencies.yaml
--- old/qtwebchannel-everywhere-src-6.12.0/dependencies.yaml    2026-09-27 
12:11:37.000000000 +0200
+++ new/qtwebchannel-everywhere-src-6.12.1/dependencies.yaml    2026-11-16 
23:08:55.000000000 +0100
@@ -1,10 +1,10 @@
 dependencies:
   ../qtbase:
-    ref: 025bdad181de241e81bf853c8a2d7bf3d19261a9
+    ref: 5af1a37e31a869cd6eb8a73d82e2c71a450e6634
     required: true
   ../qtdeclarative:
-    ref: 4332fbbb4c340463dc8cee36dda0c85d932122d8
+    ref: 935c3c01bc74fee3b8725ae502cd67bb99e3b7e2
     required: false
   ../qtwebsockets:
-    ref: 6aedb199b5d8ee4afa4cfc956ded22bc0a2632e9
+    ref: 130f50637124ac4c490185bbc44ebed358cb36c0
     required: false
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/qtwebchannel-everywhere-src-6.12.0/src/webchannel/qmetaobjectpublisher.cpp 
new/qtwebchannel-everywhere-src-6.12.1/src/webchannel/qmetaobjectpublisher.cpp
--- 
old/qtwebchannel-everywhere-src-6.12.0/src/webchannel/qmetaobjectpublisher.cpp  
    2026-09-27 12:11:37.000000000 +0200
+++ 
new/qtwebchannel-everywhere-src-6.12.1/src/webchannel/qmetaobjectpublisher.cpp  
    2026-11-16 23:08:55.000000000 +0100
@@ -187,11 +187,15 @@
         }
 
         auto iface = QFutureInterfaceBase::get(f);
-        // If we pass a context object to f.then() and the future originates 
in a
-        // different thread, this assertions fails. Why?
-        // For the time being, work around that with 
QMetaObject::invokeMethod()
-        // in safeSendResponse().
-        Q_ASSERT(iface.resultCount() > 0);
+        // A non-void QFuture that finishes without a result is nearly always a
+        // mistake in the invoked method. It is legal, so report it rather than
+        // read a result that is not there.
+        if (iface.resultCount() == 0) {
+            qWarning("A QFuture<%s> finished without a result. The client 
receives null.",
+                     resultType.name());
+            continuation(QVariant{});
+            return;
+        }
 
         QMutexLocker<QMutex> locker(&iface.mutex());
         if (iface.resultStoreBase().resultAt(0).isVector()) {
@@ -528,7 +532,13 @@
     // start with the formal parameters
     for (qsizetype i = 0; i < names.size() - 1; ++i) {
         QMetaType mt = method.parameterMetaType(i);
-        QVariant &v = variants.emplace_back(toVariant(args.at(i), mt.id()));
+        std::optional<QVariant> converted = toVariant(args.at(i), mt.id());
+        if (!converted) {
+            qWarning() << "Cannot invoke" << method.methodSignature() << "on 
object" << object
+                       << ". Parameter" << i << "could not be converted.";
+            return QJsonValue();
+        }
+        QVariant &v = variants.emplace_back(std::move(*converted));
         parameters[i + 1] = v.data();
         names[i + 1] = mt.name();
         metaTypes[i + 1] = mt.iface();
@@ -588,9 +598,15 @@
     } else if (method.methodType() != QMetaMethod::Method && 
method.methodType() != QMetaMethod::Slot) {
         qWarning() << "Cannot invoke non-public method" << method.name() << 
"on object" << object << '.';
         return QJsonValue();
+    } else if (args.size() < method.parameterCount()) {
+        qWarning() << "Cannot invoke" << method.methodSignature() << "on" << 
object << "object:"
+                   << args.size() << "arguments given, but method requires"
+                   << method.parameterCount() << '.';
+        return QJsonValue();
     } else if (args.size() > method.parameterCount()) {
-        qWarning() << "Ignoring additional arguments while invoking method" << 
method.name() << "on object" << object << ':'
-                   << args.size() << "arguments given, but method only takes" 
<< method.parameterCount() << '.';
+        qWarning() << "Ignoring additional arguments while invoking method" << 
method.name()
+                   << "on object" << object << ':' << args.size()
+                   << "arguments given, but method only takes" << 
method.parameterCount() << '.';
     }
 
     return invokeMethod_helper(object, method, args);
@@ -649,8 +665,15 @@
     QMetaProperty property = object->metaObject()->property(propertyIndex);
     if (!property.isValid()) {
         qWarning() << "Cannot set unknown property" << propertyIndex << "of 
object" << object;
-    } else if (!property.write(object, toVariant(value, property.userType()))) 
{
-        qWarning() << "Could not write value " << value << "to property" << 
property.name() << "of object" << object;
+        return;
+    }
+    const std::optional<QVariant> variant = toVariant(value, 
property.userType());
+    if (!variant) {
+        qWarning() << "Conversion failed: Could not write value " << value << 
"to property"
+                   << property.name() << "of object" << object;
+    } else if (!property.write(object, *variant)) {
+        qWarning() << "Could not write value " << value << "to property" << 
property.name()
+                   << "of object" << object;
     }
 }
 
@@ -783,15 +806,33 @@
     return value;
 }
 
-QVariant QMetaObjectPublisher::toVariant(const QJsonValue &value, int 
targetType) const
+std::optional<QVariant>
+QMetaObjectPublisher::toVariant(const QJsonValue &value, int targetType) const
 {
     QMetaType target(targetType);
 
     if (target.flags() & QMetaType::PointerToQObject) {
+        if (value.isNull())
+            return QVariant::fromValue<QObject *>(nullptr);
         const QJsonObject obj = value.toObject();
         QObject *unwrappedObject = unwrapObject(obj.value(KEY_ID).toString());
-        if (unwrappedObject == nullptr)
-            qWarning() << "Cannot not convert non-object argument" << value << 
"to QObject*.";
+        if (!unwrappedObject) {
+            qWarning() << "Cannot convert argument" << value << "to" << 
target.name();
+            return std::nullopt;
+        }
+
+        const QMetaObject *targetMeta = target.metaObject();
+        if (!targetMeta) {
+            qWarning() << "Cannot convert argument" << value << "to" << 
target.name()
+                       << "- no metaobject is available to verify the object's 
class";
+            return std::nullopt;
+        }
+        if (!unwrappedObject->metaObject()->inherits(targetMeta)) {
+            qWarning() << "Cannot convert argument" << value << "to" << 
target.name()
+                       << "- object is a" << 
unwrappedObject->metaObject()->className()
+                       << "which does not inherit" << targetMeta->className();
+            return std::nullopt;
+        }
         return QVariant::fromValue(unwrappedObject);
     } else if (isQFlagsType(targetType)) {
         int flagsValue = value.toInt();
@@ -804,10 +845,13 @@
     if (auto converted = variant; converted.convert(target)) {
         variant = std::move(converted);
     } else if (targetType != QMetaType::QVariant) {
-        if (QVariant converted = value; converted.convert(target))
+        if (QVariant converted = value; converted.convert(target)) {
             variant = std::move(converted);
-        else
-            qWarning() << "Could not convert argument" << value << "to target 
type" << target.name() << '.';
+        } else {
+            qWarning() << "Could not convert argument" << value
+                       << "to target type" << target.name() << '.';
+            return std::nullopt;
+        }
     }
     return unwrapVariant(variant);
 }
@@ -832,7 +876,12 @@
             return IncompatibleScore;
 
         QObject *unwrappedObject = unwrapObject(object[KEY_ID].toString());
-        return unwrappedObject != nullptr ? PerfectMatchScore : 
IncompatibleScore;
+        if (!unwrappedObject)
+            return IncompatibleScore;
+        const QMetaObject *targetMeta = target.metaObject();
+        if (!targetMeta || 
!unwrappedObject->metaObject()->inherits(targetMeta))
+            return IncompatibleScore;
+        return PerfectMatchScore;
     } else if (targetType == QMetaType::QVariant) {
         return VariantScore;
     }
@@ -866,6 +915,8 @@
 
 void QMetaObjectPublisher::transportRemoved(QWebChannelAbstractTransport 
*transport)
 {
+    transportState.remove(transport);
+
     auto it = transportedWrappedObjects.find(transport);
     // It is not allowed to modify a container while iterating over it. So save
     // objects which should be removed and call objectDestroyed() on them 
later.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/qtwebchannel-everywhere-src-6.12.0/src/webchannel/qmetaobjectpublisher_p.h 
new/qtwebchannel-everywhere-src-6.12.1/src/webchannel/qmetaobjectpublisher_p.h
--- 
old/qtwebchannel-everywhere-src-6.12.0/src/webchannel/qmetaobjectpublisher_p.h  
    2026-09-27 12:11:37.000000000 +0200
+++ 
new/qtwebchannel-everywhere-src-6.12.1/src/webchannel/qmetaobjectpublisher_p.h  
    2026-11-16 23:08:55.000000000 +0100
@@ -29,6 +29,7 @@
 #include <QSet>
 
 #include <unordered_map>
+#include <optional>
 
 class tst_bench_QWebChannel;
 
@@ -219,7 +220,15 @@
     QVariant unwrapList(QVariantList list) const;
     QVariant unwrapVariant(const QVariant &value) const;
 
-    QVariant toVariant(const QJsonValue &value, int targetType) const;
+    /**
+     * Convert @p value to @p targetType.
+     *
+     * Returns std::nullopt if @p value cannot be represented as @p targetType.
+     * Callers must not invoke or write anything in that case.
+     * A returned, but invalid QVariant is distinct from nullopt and means the
+     * conversion succeeded with a null value.
+     */
+    std::optional<QVariant> toVariant(const QJsonValue &value, int targetType) 
const;
 
     /**
      * Assigns a score for the conversion from @p value to @p targetType.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/qtwebchannel-everywhere-src-6.12.0/src/webchannel/signalhandler_p.h 
new/qtwebchannel-everywhere-src-6.12.1/src/webchannel/signalhandler_p.h
--- old/qtwebchannel-everywhere-src-6.12.0/src/webchannel/signalhandler_p.h     
2026-09-27 12:11:37.000000000 +0200
+++ new/qtwebchannel-everywhere-src-6.12.1/src/webchannel/signalhandler_p.h     
2026-11-16 23:08:55.000000000 +0100
@@ -53,6 +53,7 @@
      * Decrease the connection counter for the connection to the given signal.
      *
      * When the counter drops to zero, the connection is disconnected.
+     * Does nothing when the signal is not connected.
      */
     void disconnectFrom(const QObject *object, const int signalIndex);
 
@@ -79,6 +80,8 @@
 
     void setupSignalArgumentTypes(const QMetaObject *metaObject, const 
QMetaMethod &signal);
 
+    friend class TestWebChannel;
+
     Receiver *m_receiver;
 
     // maps meta object -> signalIndex -> list of arguments
@@ -125,7 +128,11 @@
         qWarning("Cannot find signal with index %d of object %s", signalIndex, 
metaObject->className());
         return QMetaMethod();
     }
-    Q_ASSERT(signal.methodType() == QMetaMethod::Signal);
+    if (signal.methodType() != QMetaMethod::Signal) {
+        qWarning("Method with index %d of object %s is not a signal.",
+                 signalIndex, metaObject->className());
+        return QMetaMethod();
+    }
     return signal;
 }
 
@@ -208,15 +215,20 @@
 template<class Receiver>
 void SignalHandler<Receiver>::disconnectFrom(const QObject *object, const int 
signalIndex)
 {
-    Q_ASSERT(m_connectionsCounter.value(object).contains(signalIndex));
-    ConnectionPair &connection = m_connectionsCounter[object][signalIndex];
+    auto objectIt = m_connectionsCounter.find(object);
+    if (objectIt == m_connectionsCounter.end())
+        return;
+    auto signalIt = objectIt->find(signalIndex);
+    if (signalIt == objectIt->end())
+        return;
+
+    ConnectionPair &connection = *signalIt;
     --connection.second;
     if (!connection.second || !connection.first) {
         QObject::disconnect(connection.first);
-        m_connectionsCounter[object].remove(signalIndex);
-        if (m_connectionsCounter[object].isEmpty()) {
-            m_connectionsCounter.remove(object);
-        }
+        objectIt->erase(signalIt);
+        if (objectIt->isEmpty())
+            m_connectionsCounter.erase(objectIt);
     }
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/qtwebchannel-everywhere-src-6.12.0/tests/auto/webchannel/tst_webchannel.cpp 
new/qtwebchannel-everywhere-src-6.12.1/tests/auto/webchannel/tst_webchannel.cpp
--- 
old/qtwebchannel-everywhere-src-6.12.0/tests/auto/webchannel/tst_webchannel.cpp 
    2026-09-27 12:11:37.000000000 +0200
+++ 
new/qtwebchannel-everywhere-src-6.12.1/tests/auto/webchannel/tst_webchannel.cpp 
    2026-11-16 23:08:55.000000000 +0100
@@ -21,10 +21,14 @@
 #include <QtConcurrent>
 #endif
 
+#include <cstddef>
 #include <memory>
+#include <new>
 #include <optional>
 #include <vector>
 
+using namespace Qt::StringLiterals;
+
 QT_USE_NAMESPACE
 
 #ifdef WEBCHANNEL_TESTS_CAN_USE_JS_ENGINE
@@ -314,6 +318,14 @@
     emit lastDoubleChanged();
 }
 
+void TestWebChannel::setIntDouble(int i, double d)
+{
+    m_lastInt = i;
+    emit lastIntChanged();
+    m_lastDouble = d;
+    emit lastDoubleChanged();
+}
+
 QVariant TestWebChannel::readVariant() const
 {
     return m_lastVariant;
@@ -1063,8 +1075,10 @@
     QFETCH(QJsonValue, json);
     QFETCH(QVariant, targetVariant);
 
-    QVariant convertedValue = channel.d_func()->publisher->toVariant(json, 
targetVariant.userType());
-    QCOMPARE(convertedValue, targetVariant);
+    const std::optional<QVariant> convertedValue =
+            channel.d_func()->publisher->toVariant(json, 
targetVariant.userType());
+    QVERIFY(convertedValue);
+    QCOMPARE(*convertedValue, targetVariant);
 }
 
 void TestWebChannel::testInfiniteRecursion()
@@ -1423,6 +1437,289 @@
         QCOMPARE(transport->messagesSent().size(), deleteChannel ? 0 : 1);
 }
 
+void TestWebChannel::testRejectsMissingArguments()
+{
+    QWebChannel channel;
+    channel.connectTo(m_dummyTransport);
+    auto *publisher = channel.d_func()->publisher;
+
+    const int index = metaObject()->indexOfMethod("setInt(int)");
+    QVERIFY(index >= 0);
+
+    m_lastInt = 0;
+    publisher->invokeMethod(this, index, QJsonArray{42});
+    QCOMPARE(m_lastInt, 42);
+
+    QTest::ignoreMessage(QtWarningMsg,
+                         QRegularExpression("0 arguments given, but method 
requires 1"));
+    publisher->invokeMethod(this, index, QJsonArray());
+    QCOMPARE(m_lastInt, 42);
+
+    const int index2 = metaObject()->indexOfMethod("setIntDouble(int,double)");
+    QVERIFY(index2 >= 0);
+
+    m_lastInt = 7;
+    m_lastDouble = 4.2;
+
+    QTest::ignoreMessage(QtWarningMsg,
+                         QRegularExpression("1 arguments given, but method 
requires 2"));
+    publisher->invokeMethod(this, index2, QJsonArray{1});
+    QCOMPARE(m_lastInt, 7);
+    QCOMPARE(m_lastDouble, 4.2);
+}
+
+void TestWebChannel::testRejectsUnresolvableObjectId()
+{
+    QWebChannel channel;
+    channel.connectTo(m_dummyTransport);
+
+    TestObject obj;
+    obj.setObjectProperty(&obj);
+    channel.registerObject(u"obj"_s, &obj);
+    auto *publisher = channel.d_func()->publisher;
+    publisher->initializeClient(m_dummyTransport);
+
+    const int index = obj.metaObject()->indexOfProperty("objectProperty");
+    QVERIFY(index >= 0);
+
+    QTest::ignoreMessage(QtWarningMsg,
+                         QRegularExpression("No wrapped object"));
+    QTest::ignoreMessage(QtWarningMsg,
+                         QRegularExpression("Cannot convert argument 
QJsonValue"));
+    QTest::ignoreMessage(QtWarningMsg,
+                         QRegularExpression("Conversion failed:"));
+    publisher->setProperty(&obj, index,
+                           QJsonObject{{ u"id"_s, u"nope"_s }});
+
+    // Must be left alone, not overwritten with nullptr.
+    QCOMPARE(obj.objectProperty(), &obj);
+}
+
+void TestWebChannel::testRejectsUnresolvableObjectIdInMethodCall()
+{
+    QWebChannel channel;
+    channel.connectTo(m_dummyTransport);
+
+    TestObject obj;
+    channel.registerObject(u"obj"_s, &obj);
+    auto *publisher = channel.d_func()->publisher;
+    publisher->initializeClient(m_dummyTransport);
+    obj.setObjectProperty(&obj);
+
+    QTest::ignoreMessage(QtWarningMsg,
+                         QRegularExpression("No wrapped object"));
+    QTest::ignoreMessage(QtWarningMsg,
+                         QRegularExpression("No wrapped object"));
+    QTest::ignoreMessage(QtWarningMsg,
+                         QRegularExpression("Cannot convert argument 
QJsonValue"));
+    QTest::ignoreMessage(QtWarningMsg,
+                         QRegularExpression("Cannot invoke"));
+
+    // Same rejection, but through invokeMethod_helper rather than setProperty.
+    publisher->invokeMethod(&obj, "setObjectProperty"_ba,
+                            QJsonArray{ QJsonObject{{ u"id"_s, u"nope"_s }} });
+
+    // Must be left alone, not overwritten with nullptr.
+    QCOMPARE(obj.objectProperty(), &obj);
+}
+
+void TestWebChannel::testAcceptsExplicitNullForObjectPointer()
+{
+    QWebChannel channel;
+    channel.connectTo(m_dummyTransport);
+
+    TestObject obj;
+    obj.setObjectProperty(&obj);
+    channel.registerObject(u"obj"_s, &obj);
+    auto *publisher = channel.d_func()->publisher;
+    publisher->initializeClient(m_dummyTransport);
+
+    const int index = obj.metaObject()->indexOfProperty("objectProperty");
+    publisher->setProperty(&obj, index, QJsonValue(QJsonValue::Null));
+
+    // Rejecting unresolvable ids must not break the legitimate null case.
+    QCOMPARE(obj.objectProperty(), nullptr);
+}
+
+// Mismatched classes used to be caught by QMetaProperty::write().
+// toVariant() now rejects them itself, so the wrong class never
+// reaches the property. The variant is typed to match the property,
+// so write() no longer converts and no longer checks.
+void TestWebChannel::testRejectsMismatchedObjectClass()
+{
+    QWebChannel channel;
+    channel.connectTo(m_dummyTransport);
+
+    TestObject receiver;
+    QObject decoy;
+    channel.registerObject(u"receiver"_s, &receiver);
+    channel.registerObject(u"decoy"_s, &decoy);
+    auto *publisher = channel.d_func()->publisher;
+    publisher->initializeClient(m_dummyTransport);
+
+    receiver.setReturnedObject(nullptr);
+
+    // returnedObject is declared TestObject*, so a plain QObject must be 
refused.
+    const int index = receiver.metaObject()->indexOfProperty("returnedObject");
+    QVERIFY(index >= 0);
+
+    QTest::ignoreMessage(QtWarningMsg,
+                         QRegularExpression("Cannot convert argument 
QJsonValue"));
+    QTest::ignoreMessage(QtWarningMsg,
+                         QRegularExpression("Conversion failed:"));
+
+    publisher->setProperty(&receiver, index,
+                           QJsonObject{ { u"id"_s, u"decoy"_s } });
+
+    QCOMPARE(receiver.returnedObject(), nullptr);
+}
+
+void TestWebChannel::testRejectsMismatchedObjectClassByName()
+{
+    QWebChannel channel;
+    channel.connectTo(m_dummyTransport);
+
+    TestObject receiver;
+    QObject decoy;
+    channel.registerObject(u"decoy"_s, &decoy);
+    auto *publisher = channel.d_func()->publisher;
+    publisher->initializeClient(m_dummyTransport);
+
+    receiver.setReturnedObject(nullptr);
+
+    QTest::ignoreMessage(QtWarningMsg,
+                         QRegularExpression("Cannot convert argument 
QJsonValue"));
+    QTest::ignoreMessage(QtWarningMsg,
+                         QRegularExpression("Cannot invoke"));
+
+    publisher->invokeMethod(&receiver, "setReturnedObject"_ba,
+                            QJsonArray{ QJsonObject{ { u"id"_s, u"decoy"_s } } 
});
+
+    QCOMPARE(receiver.returnedObject(), nullptr);
+}
+
+void TestWebChannel::testRejectsMismatchedObjectClassByIndex()
+{
+    QWebChannel channel;
+    channel.connectTo(m_dummyTransport);
+
+    TestObject receiver;
+    QObject decoy;
+    channel.registerObject(u"decoy"_s, &decoy);
+    auto *publisher = channel.d_func()->publisher;
+    publisher->initializeClient(m_dummyTransport);
+
+    const int index =
+            
receiver.metaObject()->indexOfMethod("setReturnedObject(TestObject*)");
+    QVERIFY(index >= 0);
+
+    receiver.setReturnedObject(nullptr);
+
+    QTest::ignoreMessage(QtWarningMsg,
+                         QRegularExpression("Cannot convert argument 
QJsonValue"));
+    QTest::ignoreMessage(QtWarningMsg,
+                         QRegularExpression("Cannot invoke"));
+
+    publisher->invokeMethod(&receiver, index,
+                            QJsonArray{ QJsonObject{ { u"id"_s,
+                                                       u"decoy"_s } } });
+
+    QCOMPARE(receiver.returnedObject(), nullptr);
+}
+
+void TestWebChannel::testRejectsUnconvertibleArgument()
+{
+    QWebChannel channel;
+    channel.connectTo(m_dummyTransport);
+    auto *publisher = channel.d_func()->publisher;
+
+    const QUrl before(u"http://example.com"_s);
+    setUrl(before);
+
+    QTest::ignoreMessage(QtWarningMsg,
+                         QRegularExpression("Could not convert argument 
QJsonValue"));
+    QTest::ignoreMessage(QtWarningMsg,
+                         QRegularExpression("Cannot invoke"));
+
+    // A JSON object has no conversion to QUrl by either route.
+    publisher->invokeMethod(this, "setUrl"_ba,
+                            QJsonArray{ QJsonObject{ { u"not"_s,
+                                                       u"a url"_s } } });
+
+    QCOMPARE(readUrl(), before);
+}
+
+void TestWebChannel::testRejectsNonSignalIndex()
+{
+    QWebChannel channel;
+    TestObject obj;
+    channel.registerObject(u"obj"_s, &obj);
+    channel.connectTo(m_dummyTransport);
+    auto *publisher = channel.d_func()->publisher;
+    publisher->initializeClient(m_dummyTransport);
+
+    const int slotIndex = 
obj.metaObject()->indexOfMethod("setObjectProperty(QObject*)");
+    QVERIFY(slotIndex >= 0);
+    QCOMPARE(obj.metaObject()->method(slotIndex).methodType(), 
QMetaMethod::Slot);
+
+    QJsonObject connectMessage;
+    connectMessage[u"type"_s] = TypeConnectToSignal;
+    connectMessage[u"object"_s] = u"obj"_s;
+    connectMessage[u"signal"_s] = slotIndex;
+
+    QTest::ignoreMessage(QtWarningMsg,
+                         QRegularExpression(u"Method with index %1 .* is not a 
signal."_s.arg(slotIndex)));
+    publisher->handleMessage(connectMessage, m_dummyTransport);
+
+    auto *handler = publisher->signalHandlerFor(&obj);
+    QVERIFY(!handler->m_connectionsCounter.value(&obj).contains(slotIndex));
+    
QVERIFY(!handler->m_signalArgumentTypes.value(obj.metaObject()).contains(slotIndex));
+
+    // A real signal still connects
+    const int signalIndex = obj.metaObject()->indexOfSignal("replay()");
+    QVERIFY(signalIndex >= 0);
+    connectMessage[u"signal"_s] = signalIndex;
+    publisher->handleMessage(connectMessage, m_dummyTransport);
+
+    m_dummyTransport->clearMessages();
+    obj.fire();
+    QVERIFY(!m_dummyTransport->messagesSent().isEmpty());
+    QVERIFY(handler->m_connectionsCounter.value(&obj).contains(signalIndex));
+    
QVERIFY(handler->m_signalArgumentTypes.value(obj.metaObject()).contains(signalIndex));
+}
+
+void TestWebChannel::testIgnoresDisconnectFromUnconnectedSignal()
+{
+    QWebChannel channel;
+    TestObject obj;
+    channel.registerObject(u"obj"_s, &obj);
+    channel.connectTo(m_dummyTransport);
+    auto *publisher = channel.d_func()->publisher;
+    publisher->initializeClient(m_dummyTransport);
+
+    const int signalIndex = obj.metaObject()->indexOfSignal("replay()");
+    QVERIFY(signalIndex >= 0);
+    auto *handler = publisher->signalHandlerFor(&obj);
+    QVERIFY(!handler->m_connectionsCounter.value(&obj).contains(signalIndex));
+
+    QJsonObject disconnectMessage;
+    disconnectMessage[u"type"_s] = TypeDisconnectFromSignal;
+    disconnectMessage[u"object"_s] = u"obj"_s;
+    disconnectMessage[u"signal"_s] = signalIndex;
+    publisher->handleMessage(disconnectMessage, m_dummyTransport);
+    // The lookup must not create the entry it failed to find.
+    QVERIFY(!handler->m_connectionsCounter.value(&obj).contains(signalIndex));
+
+    // The guard must not break a disconnect of a signal that is connected.
+    QJsonObject connectMessage = disconnectMessage;
+    connectMessage[u"type"_s] = TypeConnectToSignal;
+    publisher->handleMessage(connectMessage, m_dummyTransport);
+    
QVERIFY(handler->m_connectionsCounter.value(&obj).value(signalIndex).first);
+    
QCOMPARE(handler->m_connectionsCounter.value(&obj).value(signalIndex).second, 
1);
+    publisher->handleMessage(disconnectMessage, m_dummyTransport);
+    QVERIFY(!handler->m_connectionsCounter.value(&obj).contains(signalIndex));
+}
+
 #if QT_CONFIG(future)
 void TestWebChannel::testAsyncMethodReturningFuture_data()
 {
@@ -1575,6 +1872,98 @@
     // don't crash when the transports are destroyed
 }
 
+// Scenario: A transport is destroyed while it is still connected.
+// Given a publisher that holds per-transport state for the transport,
+// when the transport is destroyed,
+// then the publisher erases the per-transport state.
+void TestWebChannel::qtbug150200_transportStateRemovedOnDestroy()
+{
+    // GIVEN: A publisher that holds per-transport state
+    QWebChannel channel;
+    QMetaObjectPublisher *publisher = channel.d_func()->publisher;
+    auto transport = std::make_unique<DummyTransport>();
+
+    channel.connectTo(transport.get());
+    publisher->initializeClient(transport.get());
+    publisher->setClientIsIdle(true, transport.get());
+    QCOMPARE(publisher->transportState.size(), 1);
+
+    // WHEN: The transport is destroyed
+    transport.reset();
+
+    // THEN: The publisher erases the per-transport state
+    QCOMPARE(publisher->transportState.size(), 0);
+}
+
+// Scenario: A transport is disconnected from the channel.
+// Given a publisher that holds per-transport state for the transport,
+// when the transport is disconnected,
+// then the publisher erases the per-transport state.
+void TestWebChannel::qtbug150200_transportStateRemovedOnDisconnect()
+{
+    // GIVEN: A publisher that holds per-transport state
+    QWebChannel channel;
+    QMetaObjectPublisher *publisher = channel.d_func()->publisher;
+    DummyTransport transport;
+
+    channel.connectTo(&transport);
+    publisher->initializeClient(&transport);
+    publisher->setClientIsIdle(true, &transport);
+    QCOMPARE(publisher->transportState.size(), 1);
+
+    // WHEN: The transport is disconnected
+    channel.disconnectFrom(&transport);
+
+    // THEN: The publisher erases the per-transport state
+    QCOMPARE(publisher->transportState.size(), 0);
+}
+
+// Scenario: A new transport reuses the address of a destroyed transport.
+// Given a destroyed transport that was idle and had a queued message,
+// when a new transport is constructed at the same address,
+// then the new client is not idle and gets no queued message.
+void TestWebChannel::qtbug150200_newTransportDoesNotInheritState()
+{
+    // Runs the destructor of a transport that was constructed in place,
+    // and leaves the storage itself alone.
+    struct InPlaceDeleter
+    {
+        void operator()(DummyTransport *transport) const
+        {
+            transport->~DummyTransport();
+        }
+    };
+    using InPlaceTransport = std::unique_ptr<DummyTransport, InPlaceDeleter>;
+
+    // GIVEN: A destroyed transport that was idle and had a queued message
+    QWebChannel channel;
+    QMetaObjectPublisher *publisher = channel.d_func()->publisher;
+
+    alignas(DummyTransport) std::byte storage[sizeof(DummyTransport)];
+    InPlaceTransport oldTransport(new (storage) DummyTransport);
+    const void *oldAddress = oldTransport.get();
+
+    channel.connectTo(oldTransport.get());
+    publisher->initializeClient(oldTransport.get());
+    publisher->setClientIsIdle(true, oldTransport.get());
+    publisher->enqueueMessage(QJsonObject{{"type", "stale"}},
+                              oldTransport.get());
+    QCOMPARE(publisher->isClientIdle(oldTransport.get()), true);
+
+    oldTransport.reset();
+
+    // WHEN: A new transport is constructed at the same address
+    InPlaceTransport newTransport(new (storage) DummyTransport);
+    QCOMPARE(static_cast<const void *>(newTransport.get()), oldAddress);
+    channel.connectTo(newTransport.get());
+    publisher->initializeClient(newTransport.get());
+
+    // THEN: The new client is not idle and gets no queued message
+    QCOMPARE(publisher->isClientIdle(newTransport.get()), false);
+    publisher->setClientIsIdle(true, newTransport.get());
+    QCOMPARE(newTransport->messagesSent().size(), 0);
+}
+
 QTEST_MAIN(TestWebChannel)
 
 #include "tst_webchannel.moc"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/qtwebchannel-everywhere-src-6.12.0/tests/auto/webchannel/tst_webchannel.h 
new/qtwebchannel-everywhere-src-6.12.1/tests/auto/webchannel/tst_webchannel.h
--- 
old/qtwebchannel-everywhere-src-6.12.0/tests/auto/webchannel/tst_webchannel.h   
    2026-09-27 12:11:37.000000000 +0200
+++ 
new/qtwebchannel-everywhere-src-6.12.1/tests/auto/webchannel/tst_webchannel.h   
    2026-11-16 23:08:55.000000000 +0100
@@ -64,6 +64,8 @@
 
     QList<QJsonObject> messagesSent() const { return mMessagesSent; }
 
+    void clearMessages() { mMessagesSent.clear(); }
+
 public slots:
     void sendMessage(const QJsonObject &message) override
     {
@@ -228,6 +230,7 @@
     void setBool(bool b);
     double readDouble() const;
     void setDouble(double d);
+    void setIntDouble(int i, double d);
     QVariant readVariant() const;
     void setVariant(const QVariant &v);
     QJsonValue readJsonValue() const;
@@ -283,6 +286,16 @@
     void testBindings();
     void testDeletionDuringMethodInvocation_data();
     void testDeletionDuringMethodInvocation();
+    void testRejectsMissingArguments();
+    void testRejectsUnresolvableObjectId();
+    void testRejectsUnresolvableObjectIdInMethodCall();
+    void testAcceptsExplicitNullForObjectPointer();
+    void testRejectsMismatchedObjectClass();
+    void testRejectsMismatchedObjectClassByName();
+    void testRejectsMismatchedObjectClassByIndex();
+    void testRejectsUnconvertibleArgument();
+    void testRejectsNonSignalIndex();
+    void testIgnoresDisconnectFromUnconnectedSignal();
 
 #if QT_CONFIG(future)
     void testAsyncMethodReturningFuture_data();
@@ -291,6 +304,9 @@
 
     void qtbug46548_overriddenProperties();
     void qtbug62388_wrapObjectMultipleTransports();
+    void qtbug150200_transportStateRemovedOnDestroy();
+    void qtbug150200_transportStateRemovedOnDisconnect();
+    void qtbug150200_newTransportDoesNotInheritState();
 
 private:
     DummyTransport *m_dummyTransport;

Reply via email to