From e2c75b5a117178140f05e0e8aa8fe6b2a321c322 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Tue, 2 Nov 2010 18:04:39 +0000 Subject: [PATCH] Fix possible crash when selecting a RSS article --- src/rss/rss_imp.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/rss/rss_imp.cpp b/src/rss/rss_imp.cpp index 656569410..acc3f90f5 100644 --- a/src/rss/rss_imp.cpp +++ b/src/rss/rss_imp.cpp @@ -485,11 +485,16 @@ void RSSImp::refreshTextBrowser() { if(selection.empty()) return; Q_ASSERT(selection.size() == 1); QTreeWidgetItem *item = selection.first(); + Q_ASSERT(item); if(item == previous_news) return; // Stop displaying previous news if necessary if(listStreams->currentFeed() == listStreams->getUnreadItem()) { if(previous_news) { + disconnect(listNews, SIGNAL(itemSelectionChanged()), this, SLOT(refreshTextBrowser())); + listNews->removeItemWidget(previous_news, 0); + Q_ASSERT(previous_news); delete previous_news; + connect(listNews, SIGNAL(itemSelectionChanged()), this, SLOT(refreshTextBrowser())); } previous_news = item; } @@ -594,6 +599,8 @@ RSSImp::RSSImp(QBtSession *BTSession) : QWidget(), BTSession(BTSession){ splitter_h->insertWidget(0, listStreams); listNews->hideColumn(NEWS_URL_COL); listNews->setColumnWidth(0, 16); + listNews->setSelectionBehavior(QAbstractItemView::SelectItems); + listNews->setSelectionMode(QAbstractItemView::SingleSelection); fillFeedsList(); refreshNewsList(listStreams->currentItem());