From 2aab24ef299bf709e0881789077294702b41cb54 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 11 Jan 2024 19:00:47 -0800 Subject: [PATCH] Prevent multiple reloads when saving Avoid potential issues with Mac libedit crashes (hopefully) Fixes https://gitlab.com/kicad/code/kicad/-/issues/14865 --- eeschema/sch_base_frame.h | 12 ++++++++++++ eeschema/symbol_editor/symbol_editor.cpp | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/eeschema/sch_base_frame.h b/eeschema/sch_base_frame.h index a55685032e..d3c1325e88 100644 --- a/eeschema/sch_base_frame.h +++ b/eeschema/sch_base_frame.h @@ -241,6 +241,18 @@ public: */ void OnSymChangeDebounceTimer( wxTimerEvent& aEvent ); + /** + * Set the modification time of the symbol library table file. + * + * This is used to detect changes to the symbol library table file. + * + * @param aTime is the modification time of the symbol library table file. + */ + void SetSymModificationTime( const wxDateTime& aTime ) + { + m_watcherLastModified = aTime; + } + protected: void handleActivateEvent( wxActivateEvent& aEvent ) override; diff --git a/eeschema/symbol_editor/symbol_editor.cpp b/eeschema/symbol_editor/symbol_editor.cpp index 0a4b03fde9..0d4c67dde3 100644 --- a/eeschema/symbol_editor/symbol_editor.cpp +++ b/eeschema/symbol_editor/symbol_editor.cpp @@ -1130,6 +1130,10 @@ bool SYMBOL_EDIT_FRAME::saveLibrary( const wxString& aLibrary, bool aNewFile ) if( !aNewFile ) { m_libMgr->ClearLibraryModified( aLibrary ); + + // Update the library modification time so that we don't reload based on the watcher + if( aLibrary == getTargetLib() ) + SetSymModificationTime( fn.GetModificationTime() ); } else {