Upstream backport: QML: Fortify qmlExecuteDeferred some more
This commit is contained in:
		
							parent
							
								
									0134d56a72
								
							
						
					
					
						commit
						40d6ae80f0
					
				
							
								
								
									
										54
									
								
								0031-QML-Fortify-qmlExecuteDeferred-some-more.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								0031-QML-Fortify-qmlExecuteDeferred-some-more.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,54 @@ | ||||
| From 453b1cb207cf3ce35b906c21c9f04a17d66074a7 Mon Sep 17 00:00:00 2001 | ||||
| From: Ulf Hermann <ulf.hermann@qt.io> | ||||
| Date: Wed, 8 Feb 2023 12:14:21 +0100 | ||||
| Subject: [PATCH 31/31] QML: Fortify qmlExecuteDeferred some more | ||||
| 
 | ||||
| I don't know how to trigger this, but a recent crash report from the CI | ||||
| shows that we can get there without a valid engine. | ||||
| 
 | ||||
| Pick-to: 6.5 | ||||
| Change-Id: I9f17894da82b8e7eab88181c96dfa8eaf7795523 | ||||
| Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> | ||||
| (cherry picked from commit f69b6f0940b178b46ecbaa5f0b4956ac44e8379e) | ||||
| ---
 | ||||
|  src/qml/qml/qqmlengine.cpp | 21 +++++++++++++-------- | ||||
|  1 file changed, 13 insertions(+), 8 deletions(-) | ||||
| 
 | ||||
| diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
 | ||||
| index d6b2711c2d..5f3367e4d2 100644
 | ||||
| --- a/src/qml/qml/qqmlengine.cpp
 | ||||
| +++ b/src/qml/qml/qqmlengine.cpp
 | ||||
| @@ -1588,17 +1588,22 @@ void qmlExecuteDeferred(QObject *object)
 | ||||
|  { | ||||
|      QQmlData *data = QQmlData::get(object); | ||||
|   | ||||
| -    if (data && !data->deferredData.isEmpty() && !data->wasDeleted(object)) {
 | ||||
| -        QQmlEnginePrivate *ep = QQmlEnginePrivate::get(data->context->engine);
 | ||||
| +    if (!data
 | ||||
| +        || !data->context
 | ||||
| +        || !data->context->engine
 | ||||
| +        || data->deferredData.isEmpty()
 | ||||
| +        || data->wasDeleted(object)) {
 | ||||
| +        return;
 | ||||
| +    }
 | ||||
|   | ||||
| -        QQmlComponentPrivate::DeferredState state;
 | ||||
| -        QQmlComponentPrivate::beginDeferred(ep, object, &state);
 | ||||
| +    QQmlEnginePrivate *ep = QQmlEnginePrivate::get(data->context->engine);
 | ||||
| +    QQmlComponentPrivate::DeferredState state;
 | ||||
| +    QQmlComponentPrivate::beginDeferred(ep, object, &state);
 | ||||
|   | ||||
| -        // Release the reference for the deferral action (we still have one from construction)
 | ||||
| -        data->releaseDeferredData();
 | ||||
| +    // Release the reference for the deferral action (we still have one from construction)
 | ||||
| +    data->releaseDeferredData();
 | ||||
|   | ||||
| -        QQmlComponentPrivate::completeDeferred(ep, &state);
 | ||||
| -    }
 | ||||
| +    QQmlComponentPrivate::completeDeferred(ep, &state);
 | ||||
|  } | ||||
|   | ||||
|  QQmlContext *qmlContext(const QObject *obj) | ||||
| -- 
 | ||||
| 2.41.0 | ||||
| 
 | ||||
| @ -12,7 +12,7 @@ | ||||
| Summary: Qt5 - QtDeclarative component | ||||
| Name:    qt5-%{qt_module} | ||||
| Version: 5.15.11 | ||||
| Release: 1%{?dist} | ||||
| Release: 2%{?dist} | ||||
| 
 | ||||
| # See LICENSE.GPL LICENSE.LGPL LGPL_EXCEPTION.txt, for details | ||||
| License: LGPL-3.0-only OR GPL-3.0-only WITH Qt-GPL-exception-1.0 | ||||
| @ -58,7 +58,7 @@ Patch27:  0027-QRecyclePool-fix-potential-UB.patch | ||||
| Patch28:  0028-QtQml-Clean-up-QQmlData-ctor.patch | ||||
| Patch29:  0029-QML-Make-notify-list-thread-safe.patch | ||||
| Patch30:  0030-Flickable-prevent-fixup-from-being-called-while-drag.patch | ||||
| 
 | ||||
| Patch31:  0031-QML-Fortify-qmlExecuteDeferred-some-more.patch | ||||
| 
 | ||||
| ## upstreamable patches | ||||
| Patch100: %{name}-gcc11.patch | ||||
| @ -241,6 +241,9 @@ make check -k -C tests ||: | ||||
| 
 | ||||
| 
 | ||||
| %changelog | ||||
| * Mon Oct 30 2023 Jan Grulich <jgrulich@redhat.com> - 5.15.11-2 | ||||
| - Upstream backport: QML: Fortify qmlExecuteDeferred some more | ||||
| 
 | ||||
| * Fri Oct 06 2023 Jan Grulich <jgrulich@redhat.com> - 5.15.11-1 | ||||
| - 5.15.11 | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user