From 598bfc652edffb047948e01c3c76eb9e0cb7db4e Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 21 Feb 2019 17:01:03 +0100 Subject: Doc: Always treat \brief as full sentence Make sure all \brief descriptions start with an upper-case letter and end with a . Also start descriptions of \class with the name of the class or struct. Change-Id: Ifd2656201f9c1dff092085508a5423ce516e2d3f Reviewed-by: Leena Miettinen --- src/core/api/qwebenginecookiestore.cpp | 2 +- src/core/api/qwebengineurlschemehandler.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/api') diff --git a/src/core/api/qwebenginecookiestore.cpp b/src/core/api/qwebenginecookiestore.cpp index 035c98342..3897fb128 100644 --- a/src/core/api/qwebenginecookiestore.cpp +++ b/src/core/api/qwebenginecookiestore.cpp @@ -382,7 +382,7 @@ void QWebEngineCookieStore::setCookieFilter(std::function Date: Mon, 18 Feb 2019 16:10:17 +0100 Subject: Fix crash on dynamic_cast in global event filter Installing an event filter on QApplication which uses dynamic_cast will crash the application since QtWebEngine is sending QTimerEvents to classes without RTTI information. Fix by 1. Moving the QObject part of MessagePumpForUIQt into api/ as a private class. 2. Using QTimer directly in WebEngineSettings, without subclassing. Fixes: QTBUG-73833 Change-Id: Ida73006a4fef76637c964f8f05468adcc4a190ce Reviewed-by: Allan Sandfeld Jensen --- src/core/api/core_api.pro | 2 + src/core/api/qwebenginemessagepumpscheduler.cpp | 72 ++++++++++++++++++++++ src/core/api/qwebenginemessagepumpscheduler_p.h | 80 +++++++++++++++++++++++++ 3 files changed, 154 insertions(+) create mode 100644 src/core/api/qwebenginemessagepumpscheduler.cpp create mode 100644 src/core/api/qwebenginemessagepumpscheduler_p.h (limited to 'src/core/api') diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro index 38dc6b39d..4b69b348a 100644 --- a/src/core/api/core_api.pro +++ b/src/core/api/core_api.pro @@ -37,6 +37,7 @@ HEADERS = \ qwebenginecookiestore.h \ qwebenginecookiestore_p.h \ qwebenginehttprequest.h \ + qwebenginemessagepumpscheduler_p.h \ qwebenginequotarequest.h \ qwebengineregisterprotocolhandlerrequest.h \ qwebengineurlrequestinterceptor.h \ @@ -50,6 +51,7 @@ SOURCES = \ qtwebenginecoreglobal.cpp \ qwebenginecookiestore.cpp \ qwebenginehttprequest.cpp \ + qwebenginemessagepumpscheduler.cpp \ qwebenginequotarequest.cpp \ qwebengineregisterprotocolhandlerrequest.cpp \ qwebengineurlrequestinfo.cpp \ diff --git a/src/core/api/qwebenginemessagepumpscheduler.cpp b/src/core/api/qwebenginemessagepumpscheduler.cpp new file mode 100644 index 000000000..34cbc49bf --- /dev/null +++ b/src/core/api/qwebenginemessagepumpscheduler.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwebenginemessagepumpscheduler_p.h" + +#include +#include +#include + +QWebEngineMessagePumpScheduler::QWebEngineMessagePumpScheduler(std::function callback) + : m_callback(std::move(callback)) +{} + +void QWebEngineMessagePumpScheduler::scheduleWork() +{ + QCoreApplication::postEvent(this, new QTimerEvent(0)); +} + +void QWebEngineMessagePumpScheduler::scheduleDelayedWork(int delay) +{ + if (delay < 0) { + killTimer(m_timerId); + m_timerId = 0; + } else if (!m_timerId || delay < QAbstractEventDispatcher::instance()->remainingTime(m_timerId)) { + killTimer(m_timerId); + m_timerId = startTimer(delay); + } +} + +void QWebEngineMessagePumpScheduler::timerEvent(QTimerEvent *ev) +{ + Q_ASSERT(!ev->timerId() || m_timerId == ev->timerId()); + killTimer(m_timerId); + m_timerId = 0; + m_callback(); +} diff --git a/src/core/api/qwebenginemessagepumpscheduler_p.h b/src/core/api/qwebenginemessagepumpscheduler_p.h new file mode 100644 index 000000000..4c9e4d600 --- /dev/null +++ b/src/core/api/qwebenginemessagepumpscheduler_p.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWEBENGINEMESSAGEPUMPSCHEDULER_P_H +#define QWEBENGINEMESSAGEPUMPSCHEDULER_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qtwebenginecoreglobal_p.h" + +#include + +#include + +QT_BEGIN_NAMESPACE + +class QWEBENGINECORE_PRIVATE_EXPORT QWebEngineMessagePumpScheduler : public QObject +{ + Q_OBJECT +public: + QWebEngineMessagePumpScheduler(std::function callback); + void scheduleWork(); + void scheduleDelayedWork(int delay); + +protected: + void timerEvent(QTimerEvent *ev) override; + +private: + int m_timerId = 0; + std::function m_callback; +}; + +QT_END_NAMESPACE + +#endif // !QWEBENGINEMESSAGEPUMPSCHEDULER_P_H -- cgit v1.2.3