From 31d27e377b899cba58c3253754cadbc1cc82196d Mon Sep 17 00:00:00 2001 From: Alex Alabuzhev Date: Sat, 27 Jan 2024 16:47:05 +0000 Subject: [PATCH] gh-783: Crash when opening a plugin via an association from a plugin panel --- far/changelog | 5 +++++ far/filelist.cpp | 19 ++++++++++++++++++- far/vbuild.m4 | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/far/changelog b/far/changelog index d1e7490c60..8182a8f015 100644 --- a/far/changelog +++ b/far/changelog @@ -1,3 +1,8 @@ +-------------------------------------------------------------------------------- +drkns 2024-01-27 16:45:12+00:00 - build 6261 + +1. gh-783: Crash when opening a plugin via an association from a plugin panel. + -------------------------------------------------------------------------------- drkns 2024-01-24 15:47:05+00:00 - build 6260 diff --git a/far/filelist.cpp b/far/filelist.cpp index 4fabb04eed..8e1ffcc601 100644 --- a/far/filelist.cpp +++ b/far/filelist.cpp @@ -2716,7 +2716,24 @@ void FileList::ProcessEnter(bool EnableExec,bool SeparateWindow,bool EnableAssoc bool OpenedPlugin = false; const auto PluginMode = m_PanelMode == panel_mode::PLUGIN_PANEL && !PluginManager::UseInternalCommand(GetPluginHandle(), PLUGIN_FARGETFILE, m_CachedOpenPanelInfo); string FileNameToDelete; - SCOPE_EXIT{ if (PluginMode && !OpenedPlugin && !FileNameToDelete.empty()) GetPluginHandle()->delayed_delete(FileNameToDelete); }; + + SCOPE_EXIT + { + if (PluginMode && !OpenedPlugin && !FileNameToDelete.empty()) + { + if (const auto PluginHandle = GetPluginHandle()) + { + PluginHandle->delayed_delete(FileNameToDelete); + } + else + { + // gh-783: in some cases the panel could be gone before we get here + delayed_deleter Deleter(true); + Deleter.add(FileNameToDelete); + } + } + }; + file_state SavedState; string strTempDir; diff --git a/far/vbuild.m4 b/far/vbuild.m4 index c5a4cf6692..35e6351688 100644 --- a/far/vbuild.m4 +++ b/far/vbuild.m4 @@ -1 +1 @@ -6260 +6261