fpicker/source/office/fileview.cxx |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 9d13202243b26d507b61eb4a787d1df2ce037e21
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Nov 24 20:27:48 2021 +0000
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Thu Nov 25 12:07:51 2021 +0100

    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 <michael.st...@allotropia.de>
    Tested-by: Jenkins

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<SvtContentEntry*>(mxTreeView->get_id(rCurEntry).toInt64());
                 mpParent->EntryRemoved( aURL );
+                bDeleted = true;
             }
         }
 
+        if (!bDeleted)
+            mxTreeView->unselect(rCurEntry);
+
         return false;
     });
 

Reply via email to