diff options
| author | Santhosh Kumar <santhosh.kumar.selvaraj@qt.io> | 2024-08-07 15:33:12 +0200 |
|---|---|---|
| committer | Santhosh Kumar <santhosh.kumar.selvaraj@qt.io> | 2024-08-09 20:22:32 +0200 |
| commit | 6c36d341e02fdcd51f23c731bc8762fb3f8a0900 (patch) | |
| tree | baa6d52601dbe449537d77d033e9f294b29f6344 /src/quick/items/qquicktableview.cpp | |
| parent | 5ca8a2477a1a14e84a3a9bec63e00b1e24c5b0ac (diff) | |
Fix crash when dragging an invalid item in the header view
Dragging an invalid item in the header view leads to a crash. It's
better to safeguard before operating anything w.r.t. to the dragged
item.
This patch fixes that issue by validating the invalid item before
performing drag operation. Also added an test case to verify the same.
Fixes: QTBUG-127782
Pick-to: 6.8
Change-Id: I95398c7410d6fb6427ec06ff4b7da42472bc6d18
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: MohammadHossein Qanbari <mohammad.qanbari@qt.io>
Diffstat (limited to 'src/quick/items/qquicktableview.cpp')
| -rw-r--r-- | src/quick/items/qquicktableview.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp index 52c02a9556..91f3857c8b 100644 --- a/src/quick/items/qquicktableview.cpp +++ b/src/quick/items/qquicktableview.cpp @@ -7307,6 +7307,8 @@ void QQuickTableViewSectionDragHandler::handleEventPoint(QPointerEvent *event, Q // Grab the image for dragging header const QPoint cell = tableView->cellAtPosition(point.position(), true); auto *item = tableView->itemAtCell(cell); + if (!item) + break; if (m_drag.isNull()) { m_drag = new QDrag(item); connect(m_drag.data(), &QDrag::actionChanged, this, |
