Skip to content

Commit

Permalink
ClosePanel fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alabuzhev committed Aug 4, 2017
1 parent 7026f54 commit ebf2638
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
4 changes: 4 additions & 0 deletions far/changelog
@@ -1,3 +1,7 @@
drkns 04.08.2017 20:07:24 +0000 - build 4999

1. С форума: "Падение при выходе “наверх” из панели результатов RESearch"

drkns 04.08.2017 00:27:23 +0000 - build 4998

1. Уточнение 4997 - погнулась замена.
Expand Down
12 changes: 9 additions & 3 deletions far/filelist.cpp
Expand Up @@ -5370,11 +5370,17 @@ bool FileList::PopPlugin(int EnableRestoreViewMode)
}

auto CurPlugin = std::move(PluginsList.back());

PluginsList.pop_back();
--Global->PluginPanelsCount;

Global->CtrlObject->Plugins->ClosePanel(std::move(CurPlugin.m_Plugin));
// We have removed current plugin panel from PluginsList already.
// However, ClosePanel provides a notification and plugins might call API functions from it.
// So GetPluginHandle() will look into m_ExpiringPluginPanel first.
{
m_ExpiringPluginPanel = CurPlugin.m_Plugin.get();
SCOPE_EXIT{ m_ExpiringPluginPanel = nullptr; };
Global->CtrlObject->Plugins->ClosePanel(std::move(CurPlugin.m_Plugin));
}

if (!PluginsList.empty())
{
Expand Down Expand Up @@ -6449,7 +6455,7 @@ void FileList::SetPluginModified()

plugin_panel* FileList::GetPluginHandle() const
{
return PluginsList.empty()? nullptr : PluginsList.back().m_Plugin.get();
return m_ExpiringPluginPanel? m_ExpiringPluginPanel : !PluginsList.empty()? PluginsList.back().m_Plugin.get() : nullptr;
}


Expand Down
1 change: 1 addition & 0 deletions far/filelist.hpp
Expand Up @@ -412,6 +412,7 @@ class FileList:public Panel
m_ListData;
std::list<PrevDataItem> PrevDataList;
std::list<PluginsListItem> PluginsList;
plugin_panel* m_ExpiringPluginPanel{};
FileSystemWatcher FSWatcher;
long UpperFolderTopFile{}, LastCurFile{ -1 };
bool ReturnCurrentFile{};
Expand Down
2 changes: 1 addition & 1 deletion far/vbuild.m4
@@ -1 +1 @@
m4_define(BUILD,4998)m4_dnl
m4_define(BUILD,4999)m4_dnl

0 comments on commit ebf2638

Please sign in to comment.