Sophie

Sophie

distrib > Mageia > cauldron > x86_64 > media > core-release-src > by-pkgid > 4c532bfb9916518564da5ba2805999f5 > files > 136

qtbase5-5.15.12-3.mga10.src.rpm

From 9353d3317336c06d77fa8762135c1923a20471cc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= <tor.arne.vestbo@qt.io>
Date: Mon, 20 Mar 2023 15:39:55 +0100
Subject: [PATCH 139/147] Guard QTabBar against nested event processing during
 moving tabs

If moving tabs results in nested event processing by the user's
code in response to the tab index changing, the mouse release
event might have been processed already, and the pressed index
is reset back to -1.

Pick-to: 6.5 6.2 5.15
Fixes: QTBUG-74478
Change-Id: I9696b10a6218456ab381ffe3a65ea471cfa42413
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 6736118b8c1d9ca1517f0539bd93acc6f99732c1)
---
 src/widgets/widgets/qtabbar.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index 9a382e96dd..7f80fcc250 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -2190,7 +2190,8 @@ void QTabBar::mouseMoveEvent(QMouseEvent *event)
                 }
             }
             // Buttons needs to follow the dragged tab
-            d->layoutTab(d->pressedIndex);
+            if (d->pressedIndex != -1)
+                d->layoutTab(d->pressedIndex);
 
             update();
         }
-- 
2.40.1