Part fix #1058: Deleting a symbolic link that is a directory results in a crash
authorColin Clark <colin.clark@cclark.uk>
Thu, 20 Jul 2023 09:08:37 +0000 (10:08 +0100)
committerColin Clark <colin.clark@cclark.uk>
Thu, 20 Jul 2023 09:08:37 +0000 (10:08 +0100)
https://github.com/BestImageViewer/geeqie/issues/1058

This patch simply aborts the delete to avoid the crash. It does not fix
the problem.

src/filedata.cc

index 23a0cfd..99b9447 100644 (file)
@@ -2987,6 +2987,16 @@ static gboolean file_data_perform_delete(FileData *fd)
 
 gboolean file_data_perform_ci(FileData *fd)
 {
+       /** @FIXME When a directory that is a symbolic link is deleted,
+        * at this point fd->change is null because no FileDataChangeInfo
+        * has been set up. Therefore there is a seg. fault.
+        * This code simply aborts the delete.
+        */
+       if (!fd->change)
+               {
+               return FALSE;
+               }
+
        FileDataChangeType type = fd->change->type;
 
        switch (type)