Pcbnew: fix lock file bug.

The lock file code would reset the lock file every other time the same
board file was opened in Pcbnew in the stand alone mode.  This created
the perfect toggle switch causing the board to be reloaded every other
time the same board was selected.

Fixes lp:1777599

https://bugs.launchpad.net/kicad/+bug/1777599
This commit is contained in:
Wayne Stambaugh 2018-09-21 19:07:54 -04:00
parent 4c37defd35
commit 3e28ac9c7c
1 changed files with 6 additions and 1 deletions

View File

@ -45,6 +45,7 @@
#include <kiway.h>
#include <kiway_player.h>
#include <trace_helpers.h>
#include <lockfile.cpp>
#include <pcbnew.h>
#include <pcbnew_id.h>
@ -419,7 +420,9 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
wxASSERT_MSG( wxFileName( fullFileName ).IsAbsolute(),
wxT( "bug in single_top.cpp or project manager." ) );
if( !LockFile( fullFileName ) )
std::unique_ptr<wxSingleInstanceChecker> lockFile = ::LockFile( fullFileName );
if( !lockFile )
{
wxString msg = wxString::Format( _(
"PCB file \"%s\" is already open." ),
@ -429,6 +432,8 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
return false;
}
m_file_checker.reset( lockFile.release() );
if( GetScreen()->IsModify() && !GetBoard()->IsEmpty() )
{
int response = YesNoCancelDialog( this, _(