tdefilereplace: fixed SEGFAULT when trying to delete or remove an entry

from the result listview.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/11/head
Michele Calgaro 5 years ago
parent a58ed21074
commit c722431cbb
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -85,16 +85,8 @@ TQString TDEFileReplaceView::getItemPath(const TQListViewItem *lvi)
TQListViewItem* TDEFileReplaceView::getCurrItemTopLevelParent() TQListViewItem* TDEFileReplaceView::getCurrItemTopLevelParent()
{ {
TQListViewItem *lvi; TQListViewItem *lvi = m_rv->currentItem();
if (!m_lviCurrent) while (lvi && lvi->parent())
{
lvi = m_rv->currentItem();
}
else
{
lvi = (TQListViewItem*)m_lviCurrent;
}
while (lvi->parent())
{ {
lvi = lvi->parent(); lvi = lvi->parent();
} }
@ -221,7 +213,6 @@ void TDEFileReplaceView::slotResultMouseButtonClicked(int button, TQListViewItem
if (button == Qt::RightButton) if (button == Qt::RightButton)
{ {
// Right mouse button: open popup menub // Right mouse button: open popup menub
m_lviCurrent = static_cast<TDEListViewItem*>(lvi);
m_menuResult->popup(pos); m_menuResult->popup(pos);
} }
} }
@ -232,7 +223,6 @@ void TDEFileReplaceView::slotResultReturnPressed (TQListViewItem *lvi)
return; return;
// Left mouse button: open item in default view // Left mouse button: open item in default view
m_lviCurrent = static_cast<TDEListViewItem*>(lvi);
slotResultOpen(); slotResultOpen();
} }
@ -243,7 +233,6 @@ void TDEFileReplaceView::slotResultProperties()
{ {
KURL url(currItemPath); KURL url(currItemPath);
(void) new KPropertiesDialog(url); (void) new KPropertiesDialog(url);
m_lviCurrent = 0;
} }
} }
@ -253,7 +242,6 @@ void TDEFileReplaceView::slotResultOpen()
if (!currItemPath.isEmpty()) if (!currItemPath.isEmpty())
{ {
(void) new KRun(KURL(currItemPath), 0, true, true); (void) new KRun(KURL(currItemPath), 0, true, true);
m_lviCurrent = 0;
} }
} }
@ -265,7 +253,6 @@ void TDEFileReplaceView::slotResultOpenWith()
KURL::List kurls; KURL::List kurls;
kurls.append(KURL(currItemPath)); kurls.append(KURL(currItemPath));
KRun::displayOpenWithDialog(kurls); KRun::displayOpenWithDialog(kurls);
m_lviCurrent = 0;
} }
} }
@ -277,7 +264,6 @@ void TDEFileReplaceView::slotResultDirOpen()
TQFileInfo fi; TQFileInfo fi;
fi.setFile(currItemPath); fi.setFile(currItemPath);
(void) new KRun (KURL::fromPathOrURL(fi.dirPath()), 0, true, true); (void) new KRun (KURL::fromPathOrURL(fi.dirPath()), 0, true, true);
m_lviCurrent = 0;
} }
} }
@ -322,8 +308,6 @@ void TDEFileReplaceView::slotResultEdit()
lvi = lvi->nextSibling(); lvi = lvi->nextSibling();
} }
m_lviCurrent = 0;
} }
void TDEFileReplaceView::slotResultRemoveEntry() void TDEFileReplaceView::slotResultRemoveEntry()
@ -332,7 +316,6 @@ void TDEFileReplaceView::slotResultRemoveEntry()
if (currItem) if (currItem)
{ {
delete currItem; delete currItem;
m_lviCurrent = 0;
} }
} }
@ -350,9 +333,7 @@ void TDEFileReplaceView::slotResultDelete()
{ {
fi.setName(currItemPath); fi.setName(currItemPath);
fi.remove(); fi.remove();
delete currItem; delete currItem;
m_lviCurrent = 0;
} }
} }
} }

@ -113,7 +113,6 @@ class TDEFileReplaceView : public TDEFileReplaceViewWdg
private: private:
TDEPopupMenu *m_menuResult; TDEPopupMenu *m_menuResult;
RCOptions *m_option; RCOptions *m_option;
TDEListViewItem *m_lviCurrent;
TDEListView *m_rv, * m_sv; TDEListView *m_rv, * m_sv;
}; };

Loading…
Cancel
Save