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 *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<TDEListViewItem*>(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<TDEListViewItem*>(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;
}
}
}

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

Loading…
Cancel
Save