summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Hindenburg <kurt.hindenburg@gmail.com>2016-09-04 23:38:07 (GMT)
committerKurt Hindenburg <kurt.hindenburg@gmail.com>2016-09-04 23:38:07 (GMT)
commit7a97832d9a02af74f179f761adbce704af761f3f (patch)
treedb70d42ebf1ed708bb86ef2a2f2070032427d9db
parent4f15c586019027d87a06645a12844aceaa8ffd94 (diff)
Use QPointer for QDrag widget
Add QPointer guard around QDrag exec()
-rw-r--r--src/ViewContainer.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ViewContainer.cpp b/src/ViewContainer.cpp
index 7e19353..f0017fd 100644
--- a/src/ViewContainer.cpp
+++ b/src/ViewContainer.cpp
@@ -443,7 +443,7 @@ TabbedViewContainer::~TabbedViewContainer()
void TabbedViewContainer::startTabDrag(int tab)
{
- QDrag* drag = new QDrag(_tabBar);
+ QPointer<QDrag> drag = new QDrag(_tabBar);
const QRect tabRect = _tabBar->tabRect(tab);
QPixmap tabPixmap = _tabBar->dragDropPixmap(tab);
@@ -463,7 +463,7 @@ void TabbedViewContainer::startTabDrag(int tab)
// start dragging
const Qt::DropAction action = drag->exec();
- if (drag->target()) {
+ if (drag && drag->target()) {
switch (action) {
case Qt::MoveAction:
// The MoveAction indicates the widget has been successfully
@@ -501,6 +501,7 @@ void TabbedViewContainer::startTabDrag(int tab)
if (_tabBar->count() > 1)
emit detachTab(this, view);
}
+ delete drag;
}
void TabbedViewContainer::querySourceIndex(const QDropEvent* event, int& sourceIndex)