From c722431cbb37b120038bd2d0731e7ef74cce9d75 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Fri, 21 Jun 2019 00:31:23 +0900 Subject: tdefilereplace: fixed SEGFAULT when trying to delete or remove an entry from the result listview. Signed-off-by: Michele Calgaro --- tdefilereplace/tdefilereplaceview.cpp | 23 ++--------------------- tdefilereplace/tdefilereplaceview.h | 1 - 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/tdefilereplace/tdefilereplaceview.cpp b/tdefilereplace/tdefilereplaceview.cpp index aa73fa8..b147da7 100644 --- a/tdefilereplace/tdefilereplaceview.cpp +++ b/tdefilereplace/tdefilereplaceview.cpp @@ -85,16 +85,8 @@ TQString TDEFileReplaceView::getItemPath(const TQListViewItem *lvi) TQListViewItem* TDEFileReplaceView::getCurrItemTopLevelParent() { - TQListViewItem *lvi; - if (!m_lviCurrent) - { - lvi = m_rv->currentItem(); - } - else - { - lvi = (TQListViewItem*)m_lviCurrent; - } - while (lvi->parent()) + TQListViewItem *lvi = m_rv->currentItem(); + while (lvi && lvi->parent()) { lvi = lvi->parent(); } @@ -221,7 +213,6 @@ void TDEFileReplaceView::slotResultMouseButtonClicked(int button, TQListViewItem if (button == Qt::RightButton) { // Right mouse button: open popup menub - m_lviCurrent = static_cast(lvi); m_menuResult->popup(pos); } } @@ -232,7 +223,6 @@ void TDEFileReplaceView::slotResultReturnPressed (TQListViewItem *lvi) return; // Left mouse button: open item in default view - m_lviCurrent = static_cast(lvi); slotResultOpen(); } @@ -243,7 +233,6 @@ void TDEFileReplaceView::slotResultProperties() { KURL url(currItemPath); (void) new KPropertiesDialog(url); - m_lviCurrent = 0; } } @@ -253,7 +242,6 @@ void TDEFileReplaceView::slotResultOpen() if (!currItemPath.isEmpty()) { (void) new KRun(KURL(currItemPath), 0, true, true); - m_lviCurrent = 0; } } @@ -265,7 +253,6 @@ void TDEFileReplaceView::slotResultOpenWith() KURL::List kurls; kurls.append(KURL(currItemPath)); KRun::displayOpenWithDialog(kurls); - m_lviCurrent = 0; } } @@ -277,7 +264,6 @@ void TDEFileReplaceView::slotResultDirOpen() TQFileInfo fi; fi.setFile(currItemPath); (void) new KRun (KURL::fromPathOrURL(fi.dirPath()), 0, true, true); - m_lviCurrent = 0; } } @@ -322,8 +308,6 @@ void TDEFileReplaceView::slotResultEdit() lvi = lvi->nextSibling(); } - - m_lviCurrent = 0; } void TDEFileReplaceView::slotResultRemoveEntry() @@ -332,7 +316,6 @@ void TDEFileReplaceView::slotResultRemoveEntry() if (currItem) { delete currItem; - m_lviCurrent = 0; } } @@ -350,9 +333,7 @@ void TDEFileReplaceView::slotResultDelete() { fi.setName(currItemPath); fi.remove(); - delete currItem; - m_lviCurrent = 0; } } } diff --git a/tdefilereplace/tdefilereplaceview.h b/tdefilereplace/tdefilereplaceview.h index 36eaa9c..cd30b4d 100644 --- a/tdefilereplace/tdefilereplaceview.h +++ b/tdefilereplace/tdefilereplaceview.h @@ -113,7 +113,6 @@ class TDEFileReplaceView : public TDEFileReplaceViewWdg private: TDEPopupMenu *m_menuResult; RCOptions *m_option; - TDEListViewItem *m_lviCurrent; TDEListView *m_rv, * m_sv; }; -- cgit v1.2.3