Check for file writability before saving part

This is a 5.1 only fix for this crash. Fixing in master requires
a major refactor of the library writability detection code.

Fixes https://gitlab.com/kicad/code/kicad/issues/3864
This commit is contained in:
Ian McInerney 2020-03-25 13:21:53 +00:00
parent bd1fb845b1
commit 6b2a8f54a1
1 changed files with 8 additions and 0 deletions

View File

@ -373,6 +373,14 @@ void LIB_EDIT_FRAME::OnSave( wxCommandEvent& aEvent )
}
else
{
wxFileName fn = Prj().SchSymbolLibTable()->GetFullURI( libName );
wxFileName docFileName = fn;
docFileName.SetExt( DOC_EXT );
// Verify the user has write privileges before attempting to save the library file.
if( !IsWritable( fn ) || !IsWritable( docFileName ) )
return;
// Save Part
if( m_libMgr->FlushPart( partName, libName ) )
m_libMgr->ClearPartModified( partName, libName );