Fix a crash in Eeschema when creating a netlist just after saving the project.
This is more a workaround than a fix. The crash was due to the fact the library cache is modified on the disk with the saving process. Fixes: lp:1702707 https://bugs.launchpad.net/kicad/+bug/1702707
This commit is contained in:
parent
83b4e45eb4
commit
d7a4fb7d8b
|
@ -146,7 +146,7 @@ public:
|
|||
|
||||
/**
|
||||
* Function GetLibSource
|
||||
* @return the name of the lib to use to load a part, or an a emty string
|
||||
* @return the name of the lib to use to load a part, or an a empty string
|
||||
* Useful to load (in lib editor or lib viewer) a part from a given library
|
||||
*/
|
||||
const wxString& GetLibSource() const
|
||||
|
@ -339,8 +339,18 @@ public:
|
|||
SCH_IO_MGR::SCH_FILE_T aPluginType = SCH_IO_MGR::SCH_LEGACY );
|
||||
~PART_LIB();
|
||||
|
||||
/**
|
||||
* @return a magic number that changes if the library has changed
|
||||
*/
|
||||
int GetModHash() const { return m_mod_hash; }
|
||||
|
||||
/**
|
||||
* Forces a change of the magic number that usually changes
|
||||
* if the library has changed. Usefull to force initializations
|
||||
* only made on library change.
|
||||
*/
|
||||
void IncModHash() { ++m_mod_hash; }
|
||||
|
||||
SCH_IO_MGR::SCH_FILE_T GetPluginType() const { return m_pluginType; }
|
||||
|
||||
void SetPluginType( SCH_IO_MGR::SCH_FILE_T aPluginType );
|
||||
|
|
|
@ -587,7 +587,16 @@ public:
|
|||
int GetMarkerCount( enum MARKER_BASE::TYPEMARKER aMarkerType,
|
||||
enum MARKER_BASE::MARKER_SEVERITY aSeverity );
|
||||
|
||||
/**
|
||||
* initializes or reinitializes the weak reference
|
||||
* to the LIB_PART for each SCH_COMPONENT found in the full schematic
|
||||
* It must be called from:
|
||||
* - Draw function
|
||||
* - when loading a schematic file
|
||||
* - before creating a netlist (in case a library is modified)
|
||||
*/
|
||||
void UpdateSymbolLinks();
|
||||
|
||||
void TestDanglingEnds();
|
||||
|
||||
/**
|
||||
|
|
|
@ -52,7 +52,21 @@ bool SCH_EDIT_FRAME::CreateArchiveLibraryCacheFile( bool aUseCurrentSheetFilenam
|
|||
fn.SetName( fn.GetName() + "-cache" );
|
||||
fn.SetExt( SchematicLibraryFileExtension );
|
||||
|
||||
return CreateArchiveLibrary( fn.GetFullPath() );
|
||||
bool success = CreateArchiveLibrary( fn.GetFullPath() );
|
||||
|
||||
// Mark the library cache as modified:
|
||||
PART_LIBS* libs = Prj().SchLibs();
|
||||
PART_LIB* libcache = libs->FindLibrary( fn.GetName() );
|
||||
|
||||
if( libcache )
|
||||
libcache->IncModHash();
|
||||
|
||||
// Update the schematic symbol library links.
|
||||
// because the lib cache has changed
|
||||
SCH_SCREENS schematic;
|
||||
schematic.UpdateSymbolLinks();
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
|
@ -65,8 +79,8 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )
|
|||
// Create a new empty library to archive components:
|
||||
std::unique_ptr<PART_LIB> archLib( new PART_LIB( LIBRARY_TYPE_EESCHEMA, aFileName ) );
|
||||
|
||||
archLib->SetCache();
|
||||
archLib->EnableBuffering(); // To save symbols to file only when the library will be fully filled
|
||||
// Save symbols to file only when the library will be fully filled
|
||||
archLib->EnableBuffering();
|
||||
|
||||
/* Examine all screens (not hierarchical sheets) used in the schematic and build a
|
||||
* library of unique symbols found in all screens. Complex hierarchies are not a
|
||||
|
|
Loading…
Reference in New Issue