From 8f4bf93f02f54d0ef2c350fe2582f75cb3f9aa36 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sun, 3 Jan 2010 14:38:59 +0000 Subject: [PATCH] - Fix defining a new label from torrent addition dialog - Stop catching SIGABRT, SIGSEGV once one is received to avoid possible infinite loop --- src/main.cpp | 4 ++++ src/transferlistfilterswidget.h | 1 + src/transferlistwidget.cpp | 7 ++++++- src/transferlistwidget.h | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index cbd4a5c45..ab5f7a3b1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -101,6 +101,8 @@ void sigtermHandler(int) { app->exit(); } void sigsegvHandler(int) { + signal(SIGABRT, 0); + signal(SIGTERM, 0); std::cerr << "\n\n*************************************************************\n"; std::cerr << "Catching SIGSEGV, please report a bug at http://bug.qbittorrent.org\nand provide the following backtrace:\n"; print_stacktrace(); @@ -108,6 +110,8 @@ void sigsegvHandler(int) { std::abort(); } void sigabrtHandler(int) { + signal(SIGABRT, 0); + signal(SIGTERM, 0); std::cerr << "\n\n*************************************************************\n"; std::cerr << "Catching SIGABRT, please report a bug at http://bug.qbittorrent.org\nand provide the following backtrace:\n"; print_stacktrace(); diff --git a/src/transferlistfilterswidget.h b/src/transferlistfilterswidget.h index f6a2fe524..1f921d964 100644 --- a/src/transferlistfilterswidget.h +++ b/src/transferlistfilterswidget.h @@ -329,6 +329,7 @@ protected slots: void torrentAdded(QModelIndex index) { Q_ASSERT(index.isValid()); QString label = transferList->model()->index(index.row(), TR_LABEL).data(Qt::DisplayRole).toString().trimmed(); + qDebug("New torrent was added with label: %s", label.toLocal8Bit().data()); if(!label.isEmpty()) { if(!customLabels.contains(label)) { addLabel(label); diff --git a/src/transferlistwidget.cpp b/src/transferlistwidget.cpp index 464e28a08..5e0080043 100644 --- a/src/transferlistwidget.cpp +++ b/src/transferlistwidget.cpp @@ -192,7 +192,7 @@ void TransferListWidget::addTorrent(QTorrentHandle& h) { if(listModel->rowCount() == 1) selectionModel()->setCurrentIndex(proxyModel->index(row, TR_NAME), QItemSelectionModel::SelectCurrent|QItemSelectionModel::Rows); // Emit signal - emit torrentAdded(listModel->index(row, 0)); + emit torrentAdded(mapFromSource(listModel->index(row, 0))); // Refresh the list refreshList(); } catch(invalid_handle e) { @@ -490,6 +490,11 @@ QModelIndex TransferListWidget::mapToSource(QModelIndex index) const { return labelFilterModel->mapToSource(proxyModel->mapToSource(index)); } +QModelIndex TransferListWidget::mapFromSource(QModelIndex index) const { + return proxyModel->mapFromSource(labelFilterModel->mapFromSource(index)); +} + + QStringList TransferListWidget::getCustomLabels() const { QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); settings.beginGroup(QString::fromUtf8("TransferListFilters")); diff --git a/src/transferlistwidget.h b/src/transferlistwidget.h index 2fe1c5550..08e7d071b 100644 --- a/src/transferlistwidget.h +++ b/src/transferlistwidget.h @@ -64,6 +64,7 @@ protected: int getRowFromHash(QString hash) const; QString getHashFromRow(int row) const; QModelIndex mapToSource(QModelIndex index) const; + QModelIndex mapFromSource(QModelIndex index) const; QStringList getCustomLabels() const; void saveColWidthList(); bool loadColWidthList();