From 5137b54bd8e526a87bfaad7f0cca2a2a0cb259d2 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 19 May 2019 11:03:44 +0200 Subject: [PATCH] Pcbnew: fix a (minor) lock file issue: the lock was too early set. If the file was (for some reason) not actually loaded, it was locked. Now, the file is locked only if it is actually loaded. --- pcbnew/files.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index c15e5c6e4e..6960be4eb6 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -450,8 +450,6 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in return false; } - m_file_checker.reset( lockFile.release() ); - if( GetScreen()->IsModify() && !GetBoard()->IsEmpty() ) { if( !HandleUnsavedChanges( this, _( "The current PCB has been modified. Save changes?" ), @@ -461,6 +459,9 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in } } + // Release the lock file, until the new file is actually loaded + m_file_checker.reset( nullptr ); + wxFileName pro = fullFileName; pro.SetExt( ProjectFileExtension ); @@ -545,6 +546,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in return false; } + // 6.0 TODO: some settings didn't make it into the board file in 5.1 so as not to // change the file format. For 5.1 we must copy them across from the config-initialized // board. @@ -603,6 +605,9 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in GetBoard()->SetFileName( fname ); } + // Lock the file newly opened: + m_file_checker.reset( lockFile.release() ); + if( !converted ) UpdateFileHistory( GetBoard()->GetFileName() );