Fix crash when CallAfter is called while destructing thread pool on exit.
PROJECT_TREE_PANE is already destructed at that point.
This commit is contained in:
@@ -230,6 +230,12 @@ PROJECT_TREE_PANE::~PROJECT_TREE_PANE()
|
||||
Unbind( wxEVT_TIMER, wxTimerEventHandler( PROJECT_TREE_PANE::onGitStatusTimer ), this,
|
||||
m_gitStatusTimer.GetId() );
|
||||
shutdownFileWatcher();
|
||||
|
||||
if( m_gitSyncTask.valid() )
|
||||
m_gitSyncTask.wait();
|
||||
|
||||
if( m_gitStatusIconTask.valid() )
|
||||
m_gitStatusIconTask.wait();
|
||||
}
|
||||
|
||||
|
||||
@@ -2709,7 +2715,7 @@ void PROJECT_TREE_PANE::onGitSyncTimer( wxTimerEvent& aEvent )
|
||||
|
||||
thread_pool& tp = GetKiCadThreadPool();
|
||||
|
||||
tp.push_task(
|
||||
m_gitSyncTask = tp.submit(
|
||||
[this]()
|
||||
{
|
||||
KIGIT_COMMON* gitCommon = m_TreeProject->GitCommon();
|
||||
@@ -2743,7 +2749,7 @@ void PROJECT_TREE_PANE::gitStatusTimerHandler()
|
||||
updateTreeCache();
|
||||
thread_pool& tp = GetKiCadThreadPool();
|
||||
|
||||
tp.push_task(
|
||||
m_gitStatusIconTask = tp.submit(
|
||||
[this]()
|
||||
{
|
||||
updateGitStatusIconMap();
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <mutex>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include <future>
|
||||
#include <wx/datetime.h>
|
||||
#include <wx/fswatcher.h>
|
||||
#include <wx/laywin.h>
|
||||
@@ -322,6 +323,8 @@ private:
|
||||
wxString m_gitCurrentBranchName;
|
||||
wxTimer m_gitSyncTimer;
|
||||
wxTimer m_gitStatusTimer;
|
||||
std::future<void> m_gitSyncTask;
|
||||
std::future<void> m_gitStatusIconTask;
|
||||
|
||||
std::mutex m_gitTreeCacheMutex;
|
||||
std::unordered_map<wxString, wxTreeItemId> m_gitTreeCache;
|
||||
|
||||
Reference in New Issue
Block a user