Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.9.6, 5.11.0
-
None
Description
The function:
static bool QObject::disconnect(const QMetaObject::Connection &connection)
accepts const reference to QMetaObject::Connection but modifies it at line:
const_cast<QMetaObject::Connection &>(connection).d_ptr = 0;
Semantically it's wrong, because the QMetaObject is modified and also responds to query as not being connected after the call, so the function should have non-const reference parameter.
This disconnect function was introduced in Qt 5.0.0 but the implementation with const_cast has been changed on Qt 5.0.1.
I assume an overloaded function should have been provided instead and existing one marked as deprecated not to break binary compatibility.