From 9d13202243b26d507b61eb4a787d1df2ce037e21 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 24 Nov 2021 20:27:48 +0000 Subject: tdf#145842 canceling remote file delete makes file disappear from treeview we remove the selected entries from the treeview, so the user cancel's the deletion of an entry we should unselect it from the candidates to remove. and... Related: tdf#145842 fix a crash after deleting an entry delete an entry in remote files dialog and go one level up and crash, ownership of the SvtContentEntry is not with the entry, but belongs to mpImpl->maEntries Change-Id: Ieb2258960fc647ad15d8f315a18454a0dae8a420 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125793 Reviewed-by: Michael Stahl Tested-by: Jenkins --- fpicker/source/office/fileview.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'fpicker') diff --git a/fpicker/source/office/fileview.cxx b/fpicker/source/office/fileview.cxx index d8e8ce6f7d72..d3b5237384f4 100644 --- a/fpicker/source/office/fileview.cxx +++ b/fpicker/source/office/fileview.cxx @@ -642,16 +642,20 @@ void ViewTabListBox_Impl::DeleteEntries() eResult = aDlg.run(); } - if ( ( eResult == svtools::QUERYDELETE_ALL ) || - ( eResult == svtools::QUERYDELETE_YES ) ) + bool bDeleted = false; + + if (eResult == svtools::QUERYDELETE_ALL || eResult == svtools::QUERYDELETE_YES) { if ( Kill( aURL ) ) { - delete reinterpret_cast(mxTreeView->get_id(rCurEntry).toInt64()); mpParent->EntryRemoved( aURL ); + bDeleted = true; } } + if (!bDeleted) + mxTreeView->unselect(rCurEntry); + return false; }); -- cgit