diff options
author | Tobias Markmann <tm@ayena.de> | 2015-02-18 16:10:38 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2015-02-18 16:10:38 (GMT) |
commit | 2a208653fff7647bd3c03f7797d2ef43d5961784 (patch) | |
tree | cfdffff339f70278fc95ca526d8ec84d192b0fd7 /Swift | |
parent | cd176a0bd994f787ba0b6ac99a3835b72a137f0d (diff) | |
download | swift-2a208653fff7647bd3c03f7797d2ef43d5961784.zip swift-2a208653fff7647bd3c03f7797d2ef43d5961784.tar.bz2 |
Fix crash when a tab drag is aborted in trellis mode
To prevent an infinite recurison during when a tab is returned (added
again) to the original QTabWidget.
The recursion was caused by a show event that is emmitted during insert
and our QtChatTabs::handleWidgetShown function trying to add the tab
again because it is not in the QTabWidget yet; it would be if the show
event would be emitted after the insert is done and not somewhere
during the insert.
Test-Information:
Dragging a tab in trellis mode and *not* dropping it on a tab bar.
Previously this would cause an infinite recursion. Now it just returns
the tab to its previous place.
Tested on OS X 10.9.5 with Qt 5.4.0.
Change-Id: Icd54b95b6f0542b6a9d3921fa1b0ab4df409950a
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/QtUI/Trellis/QtDNDTabBar.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Swift/QtUI/Trellis/QtDNDTabBar.cpp b/Swift/QtUI/Trellis/QtDNDTabBar.cpp index 5b042d8..a6806c6 100644 --- a/Swift/QtUI/Trellis/QtDNDTabBar.cpp +++ b/Swift/QtUI/Trellis/QtDNDTabBar.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -140,7 +140,10 @@ bool QtDNDTabBar::event(QEvent* event) { Qt::DropAction dropAction = drag->exec(); if (dropAction == Qt::IgnoreAction) { // aborted drag, put tab back in place + // disable event handling during the insert for the tab to prevent infinite recursion (stack overflow) + dragWidget->blockSignals(true); dynamic_cast<QTabWidget*>(parent())->insertTab(dragIndex, dragWidget, dragText); + dragWidget->blockSignals(false); } return true; } |