From 38c636937a76e83bcbd3ca1a75d83cc55cfa2dd2 Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Mon, 18 Feb 2013 19:08:35 +0000 Subject: [PATCH] Fix season drag and drop SEGV --- src/Season.cpp | 6 ++---- src/Season.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Season.cpp b/src/Season.cpp index cbe30fa51..17d02fc6e 100644 --- a/src/Season.cpp +++ b/src/Season.cpp @@ -375,14 +375,12 @@ SeasonTreeView::dropEvent(QDropEvent* event) { // item and original position QTreeWidgetItem *item = currentItem(); - int idx1 = currentItem()->parent()->indexOfChild(item); + int idx1 = invisibleRootItem()->indexOfChild(item); + int idx2 = indexAt(event->pos()).row(); // finalise drop event QTreeWidget::dropEvent(event); - // new position - int idx2 = currentItem()->parent()->indexOfChild(item); - // emit the itemMoved signal Q_EMIT itemMoved(item, idx1, idx2); } diff --git a/src/Season.h b/src/Season.h index c62fbb044..7e97aab7a 100644 --- a/src/Season.h +++ b/src/Season.h @@ -146,7 +146,7 @@ class SeasonTreeView : public QTreeWidget public: SeasonTreeView(); - Q_SIGNALS: + signals: void itemMoved(QTreeWidgetItem* item, int previous, int actual); protected: