diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index 40946744a8..0a86ee1905 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -412,13 +413,17 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in // We insist on caller sending us an absolute path, if it does not, we say it's a bug. wxASSERT_MSG( wxFileName( fullFileName ).IsAbsolute(), wxT( "Path is not absolute!" ) ); - if( !LockFile( fullFileName ) ) + std::unique_ptr lockFile = ::LockFile( fullFileName ); + + if( !lockFile ) { wxString msg = wxString::Format( _( "PCB file \"%s\" is already open." ), fullFileName ); DisplayError( this, msg ); return false; } + m_file_checker.reset( lockFile.release() ); + if( GetScreen()->IsModify() && !GetBoard()->IsEmpty() ) { if( !HandleUnsavedChanges( this, _( "The current PCB has been modified. Save changes?" ),