diff options
Diffstat (limited to 'src/webchannel/qwebchannel.cpp')
-rw-r--r-- | src/webchannel/qwebchannel.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/webchannel/qwebchannel.cpp b/src/webchannel/qwebchannel.cpp index 0e9a4c5..050d04e 100644 --- a/src/webchannel/qwebchannel.cpp +++ b/src/webchannel/qwebchannel.cpp @@ -46,6 +46,8 @@ #include <QJsonDocument> #include <QJsonObject> +#include <algorithm> + QT_BEGIN_NAMESPACE /*! @@ -81,10 +83,10 @@ QT_BEGIN_NAMESPACE */ void QWebChannelPrivate::_q_transportDestroyed(QObject *object) { - QWebChannelAbstractTransport *transport = static_cast<QWebChannelAbstractTransport*>(object); - const int idx = transports.indexOf(transport); - if (idx != -1) { - transports.remove(idx); + auto it = std::find(transports.begin(), transports.end(), object); + if (it != transports.end()) { + auto *transport = *it; + transports.erase(it); publisher->transportRemoved(transport); } } |