From 78edc18057d04a8329060b52d78833711bcadf39 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sat, 25 Jan 2020 00:48:48 +0100 Subject: QGraphicsProxyWidget: fix handling of proxy focus If a widget inside a QGPW has a proxy focus, the code would keep sending focus in events to the proxy even if the proxy was already focused. Amend the check in place to prevent this from happening. Change-Id: Id28d3bfe4f396da5c9477df713441ca7d506662f Fixes: QTBUG-51856 Reviewed-by: Christian Ehrlicher Reviewed-by: Richard Moe Gustavsen --- src/widgets/kernel/qwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets/kernel') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index c389c4ab4d..8ec7f7e072 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -6309,7 +6309,7 @@ void QWidget::setFocus(Qt::FocusReason reason) previousProxyFocus = topData->proxyWidget->widget()->focusWidget(); if (previousProxyFocus && previousProxyFocus->focusProxy()) previousProxyFocus = previousProxyFocus->focusProxy(); - if (previousProxyFocus == this && !topData->proxyWidget->d_func()->proxyIsGivingFocus) + if (previousProxyFocus == f && !topData->proxyWidget->d_func()->proxyIsGivingFocus) return; } } -- cgit v1.2.3 From aadf21b25cad7026f07a5fe7bf19fbedfb1866b7 Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Fri, 31 Jan 2020 16:47:46 +0100 Subject: Fix 'the the' typo in comments Change-Id: I00fcb1c2374e7ca168b6240f9d41c0323fb0867c Reviewed-by: Giuseppe D'Angelo --- src/widgets/kernel/qopenglwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets/kernel') diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index bc5ca21b97..d244162ba3 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -379,7 +379,7 @@ QT_BEGIN_NAMESPACE This is naturally not the only possible solution. One alternative is to use the \l{QOpenGLContext::aboutToBeDestroyed()}{aboutToBeDestroyed()} signal of QOpenGLContext. By connecting a slot, using direct connection, to this signal, - it is possible to perform cleanup whenever the the underlying native context + it is possible to perform cleanup whenever the underlying native context handle, or the entire QOpenGLContext instance, is going to be released. The following snippet is in principle equivalent to the previous one: -- cgit v1.2.3 From 9ecc595d7185ad3d072f3d811d7aa52fc6992cca Mon Sep 17 00:00:00 2001 From: VaL Doroshchuk Date: Tue, 4 Feb 2020 13:18:31 +0100 Subject: widgets: Don't create winId when the widget is being destroyed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When QWidget is being destroyed, its winId is cleared, and a QEvent::WinIdChange is sent. If a listener of this event reacted by calling winId() again, we might crash. A crash can be observed when this child widget is destroyed in dtor of its parent. E.g. here is a hierarchy of widgets: 1:QWidget 2:QObject 3:QWidget 4:QWidget If a listener subscribed for WinIdChange events from (4), and there is a connection to destroy (4) when (2) is destroyed. This will lead to infinite loop: 1. QWidget::~QWidget 2. QWidget::destroy 3. QWidgetPrivate::setWinId(0) 4. QCoreApplication::sendEvent(q, QEvent::WinIdChange); 5. eventFilter 6. QWidget::winId 7. QWidgetPrivate::createWinId (this=0x555555957600) at kernel/qwidget.cpp:2380 8. QWidgetPrivate::createWinId (this=0x55555596b040) at kernel/qwidget.cpp:2387 9. QWidget::create (this=0x5555558f2010, window=0, initializeWindow=true, destroyOldWindow=true) at kernel/qwidget.cpp:1163 10. QWidgetPrivate::createWinId (this=0x55555596b040) at kernel/qwidget.cpp:2387 11. QWidget::create (this=0x5555558f2010, window=0, initializeWindow=true, destroyOldWindow=true) at kernel/qwidget.cpp:1163 12. QWidgetPrivate::createWinId (this=0x55555596b040) at kernel/qwidget.cpp:2387 Fixes: QTBUG-81849 Change-Id: Ib4c33ac97d9a79c701431ae107bddfb22720ba0d Reviewed-by: Volker Hilsheimer Reviewed-by: Tor Arne Vestbø --- src/widgets/kernel/qwidget.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/widgets/kernel') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 8ec7f7e072..e7f95ecf4d 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -2350,7 +2350,9 @@ QWidget *QWidget::find(WId id) */ WId QWidget::winId() const { - if (!testAttribute(Qt::WA_WState_Created) || !internalWinId()) { + if (!data->in_destructor + && (!testAttribute(Qt::WA_WState_Created) || !internalWinId())) + { #ifdef ALIEN_DEBUG qDebug() << "QWidget::winId: creating native window for" << this; #endif -- cgit v1.2.3