diff options
author | Jüri Valdmann <juri.valdmann@qt.io> | 2019-02-18 16:10:17 +0100 |
---|---|---|
committer | Jüri Valdmann <juri.valdmann@qt.io> | 2019-02-25 09:13:59 +0000 |
commit | 1f77d4709946511b919810354f19875824399096 (patch) | |
tree | 1fc4ff1f0df40afb0a9dbf340994c80ee178918f /src/core/api/qwebenginemessagepumpscheduler_p.h | |
parent | 837347e1901086a9757b5aca7e5bbee7b0d8e20e (diff) |
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 <allan.jensen@qt.io>
Diffstat (limited to 'src/core/api/qwebenginemessagepumpscheduler_p.h')
-rw-r--r-- | src/core/api/qwebenginemessagepumpscheduler_p.h | 80 |
1 files changed, 80 insertions, 0 deletions
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 <QtCore/qobject.h> + +#include <functional> + +QT_BEGIN_NAMESPACE + +class QWEBENGINECORE_PRIVATE_EXPORT QWebEngineMessagePumpScheduler : public QObject +{ + Q_OBJECT +public: + QWebEngineMessagePumpScheduler(std::function<void()> callback); + void scheduleWork(); + void scheduleDelayedWork(int delay); + +protected: + void timerEvent(QTimerEvent *ev) override; + +private: + int m_timerId = 0; + std::function<void()> m_callback; +}; + +QT_END_NAMESPACE + +#endif // !QWEBENGINEMESSAGEPUMPSCHEDULER_P_H |